|
|
|
@@ -1,6 +1,8 @@ |
|
|
|
package models |
|
|
|
|
|
|
|
import ( |
|
|
|
"fmt" |
|
|
|
|
|
|
|
"code.gitea.io/gitea/modules/log" |
|
|
|
"xorm.io/xorm" |
|
|
|
) |
|
|
|
@@ -12,6 +14,7 @@ type CustomMigration struct { |
|
|
|
|
|
|
|
var customMigrations = []CustomMigration{ |
|
|
|
{"Custom v1 Topic struct change to support chinese", syncTopicStruct}, |
|
|
|
{"Delete zuzhi user history data ", deleteNotDisplayUser}, |
|
|
|
} |
|
|
|
|
|
|
|
var customMigrationsStatic = []CustomMigration{} |
|
|
|
@@ -47,3 +50,19 @@ func syncTopicStruct(x *xorm.Engine) error { |
|
|
|
_, err := x.Exec(query) |
|
|
|
return err |
|
|
|
} |
|
|
|
|
|
|
|
func deleteNotDisplayUser(x *xorm.Engine) error { |
|
|
|
|
|
|
|
sess := x.NewSession() |
|
|
|
defer sess.Close() |
|
|
|
sess.Select("`user`.*").Table("user").Where("type == 1") |
|
|
|
userList := make([]*User, 0) |
|
|
|
|
|
|
|
for i, userRecord := range userList { |
|
|
|
log.Info("delete zuzi user, i=" + fmt.Sprint(i) + " userName=" + userRecord.Name) |
|
|
|
deleteSql := "delete from user_business_analysis where id=" + fmt.Sprint(userRecord.ID) + " and name='" + userRecord.Name + "'" |
|
|
|
xStatistic.Exec(deleteSql) |
|
|
|
} |
|
|
|
|
|
|
|
return nil |
|
|
|
} |