diff --git a/backend/init/migration/migrate.go b/backend/init/migration/migrate.go index 3b119e62b..cf40f8b51 100644 --- a/backend/init/migration/migrate.go +++ b/backend/init/migration/migrate.go @@ -39,6 +39,7 @@ func Init() { migrations.UpdateRedisParam, migrations.UpdateCronjobWithDb, migrations.AddTableFirewall, + migrations.AddMariaDB, migrations.UpdateDatabase, }) if err := m.Migrate(); err != nil { diff --git a/backend/init/migration/migrations/init.go b/backend/init/migration/migrations/init.go index 5fb19bfb2..3618f5b3f 100644 --- a/backend/init/migration/migrations/init.go +++ b/backend/init/migration/migrations/init.go @@ -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 {