This commit is contained in:
2026-08-09 09:50:31 +08:00
parent ebed85772f
commit 5b9a6c6cc5
5 changed files with 161 additions and 182 deletions

View File

@@ -39,7 +39,7 @@ func NewDatabase(driver string, dsn []string, options *types.SqlOptions) (db *go
}
// 自动迁移表结构
if len(MigrateTables) > 0 {
if len(MigrateTables) > 0 && options.IsAutoMigrate {
err = db.AutoMigrate(MigrateTables...)
if err != nil {
return nil, err