Browse Source

提交代码。

Signed-off-by: zouap <zouap@pcl.ac.cn>
pull/1036/head
zouap 3 years ago
parent
commit
8bf634386b
1 changed files with 7 additions and 3 deletions
  1. +7
    -3
      models/custom_migrations.go

+ 7
- 3
models/custom_migrations.go View File

@@ -10,14 +10,18 @@ import (
type CustomMigration struct {
Description string
Migrate func(*xorm.Engine) error
MigrateAll func(*xorm.Engine, *xorm.Engine) error
}

type CustomMigrationStatic struct {
Description string
Migrate func(*xorm.Engine, *xorm.Engine) error
}

var customMigrations = []CustomMigration{
{"Custom v1 Topic struct change to support chinese", syncTopicStruct},
}

var customMigrationsStatic = []CustomMigration{
var customMigrationsStatic = []CustomMigrationStatic{
{"Delete zuzhi user history data ", deleteNotDisplayUser},
}

@@ -37,7 +41,7 @@ func MigrateCustom(x *xorm.Engine) {
func MigrateCustomStatic(x *xorm.Engine, static *xorm.Engine) {
for _, m := range customMigrationsStatic {
log.Info("Migration: %s", m.Description)
if err := m.MigrateAll(x, static); err != nil {
if err := m.Migrate(x, static); err != nil {

log.Error("Migration: %v", err)



Loading…
Cancel
Save