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