|
|
@@ -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() |
|
|
|