Browse Source

提交代码。

Signed-off-by: zouap <zouap@pcl.ac.cn>
tags/v1.22.5.2
zouap 3 years ago
parent
commit
1d4be6af12
1 changed files with 0 additions and 22 deletions
  1. +0
    -22
      models/custom_migrations.go

+ 0
- 22
models/custom_migrations.go View File

@@ -1,8 +1,6 @@
package models

import (
"fmt"

"code.gitea.io/gitea/modules/log"
"xorm.io/xorm"
)
@@ -22,7 +20,6 @@ var customMigrations = []CustomMigration{
}

var customMigrationsStatic = []CustomMigrationStatic{
{"Delete organization user history data ", deleteNotDisplayUser},
{"update issue_fixed_rate to 1 if num_issues is 0 ", updateIssueFixedRate},
}

@@ -36,7 +33,6 @@ func MigrateCustom(x *xorm.Engine) {

}
}

}

func MigrateCustomStatic(x *xorm.Engine, static *xorm.Engine) {
@@ -58,24 +54,6 @@ func syncTopicStruct(x *xorm.Engine) error {
return err
}

func deleteNotDisplayUser(x *xorm.Engine, static *xorm.Engine) error {

querySQL := "select id,name from public.user where type=1"
rows, err := x.Query(querySQL)
if err != nil {
log.Info("select db failed,err:", err)
return err
}

for i, userRow := range rows {
log.Info("delete zuzi user, i=" + fmt.Sprint(i) + " userName=" + string(userRow["name"]))
deleteSql := "delete from user_business_analysis where id=" + string(userRow["id"]) + " and name='" + string(userRow["name"]) + "'"
static.Exec(deleteSql)
}

return nil
}

func updateIssueFixedRate(x *xorm.Engine, static *xorm.Engine) error {
updateSQL := "update repo_statistic set issue_fixed_rate=1.0 where num_issues=0"
_, err := static.Exec(updateSQL)


Loading…
Cancel
Save