diff options
Diffstat (limited to 'models/consistency.go')
-rw-r--r-- | models/consistency.go | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/models/consistency.go b/models/consistency.go index fbb99ca80c..f689261a55 100644 --- a/models/consistency.go +++ b/models/consistency.go @@ -291,7 +291,17 @@ func CountNullArchivedRepository() (int64, error) { // FixNullArchivedRepository sets is_archived to false where it is null func FixNullArchivedRepository() (int64, error) { - return x.Where(builder.IsNull{"is_archived"}).Cols("is_archived").Update(&Repository{ + return x.Where(builder.IsNull{"is_archived"}).Cols("is_archived").NoAutoTime().Update(&Repository{ IsArchived: false, }) } + +// CountWrongUserType count OrgUser who have wrong type +func CountWrongUserType() (int64, error) { + return x.Where(builder.Eq{"type": 0}.And(builder.Neq{"num_teams": 0})).Count(new(User)) +} + +// FixWrongUserType fix OrgUser who have wrong type +func FixWrongUserType() (int64, error) { + return x.Where(builder.Eq{"type": 0}.And(builder.Neq{"num_teams": 0})).Cols("type").NoAutoTime().Update(&User{Type: 1}) +} |