From d2fb777b2df1500a30070c1ce6dd77b612f6f382 Mon Sep 17 00:00:00 2001 From: zouap Date: Mon, 15 Nov 2021 11:24:17 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zouap --- models/custom_migrations.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/models/custom_migrations.go b/models/custom_migrations.go index 43dd57b4b..d5a8299d9 100644 --- a/models/custom_migrations.go +++ b/models/custom_migrations.go @@ -10,6 +10,7 @@ import ( type CustomMigration struct { Description string Migrate func(*xorm.Engine) error + MigrateAll func(*xorm.Engine, *xorm.Engine) error } var customMigrations = []CustomMigration{ @@ -33,10 +34,10 @@ func MigrateCustom(x *xorm.Engine) { } -func MigrateCustomStatic(x *xorm.Engine) { +func MigrateCustomStatic(x *xorm.Engine, static *xorm.Engine) { for _, m := range customMigrationsStatic { log.Info("Migration: %s", m.Description) - if err := m.Migrate(x); err != nil { + if err := m.MigrateAll(x, static); err != nil { log.Error("Migration: %v", err) @@ -52,7 +53,7 @@ func syncTopicStruct(x *xorm.Engine) error { return err } -func deleteNotDisplayUser(static *xorm.Engine) error { +func deleteNotDisplayUser(x *xorm.Engine, static *xorm.Engine) error { sess := x.NewSession() defer sess.Close()