migrate 优化migrate

This commit is contained in:
linwenxiang
2021-04-23 14:25:31 +08:00
parent e40047a88e
commit 1a111f0666
49 changed files with 677 additions and 202 deletions
@@ -1,10 +1,11 @@
package version
import (
"gorm.io/gorm"
"runtime"
"strings"
"gorm.io/gorm"
"go-admin/cmd/migrate/migration"
common "go-admin/common/models"
)
@@ -18,7 +19,7 @@ func _1615948084336Test(db *gorm.DB, version string) error {
return db.Transaction(func(tx *gorm.DB) error {
err := tx.Exec("alter table sys_config add is_frontend int default 1 null comment '是否前台参数' after config_type").Error
if err != nil && !strings.Contains(err.Error(),"Duplicate column name 'is_frontend'") {
if err != nil && !strings.Contains(err.Error(), "Duplicate column name 'is_frontend'") {
return err
}
@@ -26,4 +27,4 @@ func _1615948084336Test(db *gorm.DB, version string) error {
Version: version,
}).Error
})
}
}