mirror of https://github.com/1Panel-dev/1Panel
fix: 修改数据库 migration (#2105)
parent
49e3d45912
commit
9f38a78512
|
@ -39,6 +39,7 @@ func Init() {
|
|||
migrations.UpdateRedisParam,
|
||||
migrations.UpdateCronjobWithDb,
|
||||
migrations.AddTableFirewall,
|
||||
migrations.AddMariaDB,
|
||||
migrations.UpdateDatabase,
|
||||
})
|
||||
if err := m.Migrate(); err != nil {
|
||||
|
|
|
@ -584,8 +584,8 @@ var AddTableFirewall = &gormigrate.Migration{
|
|||
},
|
||||
}
|
||||
|
||||
var UpdateDatabase = &gormigrate.Migration{
|
||||
ID: "20230828-update-database",
|
||||
var AddMariaDB = &gormigrate.Migration{
|
||||
ID: "20230828-add-mariadb",
|
||||
Migrate: func(tx *gorm.DB) error {
|
||||
var (
|
||||
app model.App
|
||||
|
@ -624,7 +624,13 @@ var UpdateDatabase = &gormigrate.Migration{
|
|||
}).Error; err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
},
|
||||
}
|
||||
|
||||
var UpdateDatabase = &gormigrate.Migration{
|
||||
ID: "20230829-update-database",
|
||||
Migrate: func(tx *gorm.DB) error {
|
||||
if err := global.DB.Model(&model.DatabaseMysql{}).Where("`from` != ?", "local").Updates(map[string]interface{}{
|
||||
"from": "remote",
|
||||
}).Error; err != nil {
|
||||
|
|
Loading…
Reference in New Issue