diff options
author | zeripath <art27@cantab.net> | 2020-06-11 21:18:11 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-11 16:18:11 -0400 |
commit | b9e281265ee2c510199cd0241ae02bff2bd8ecc1 (patch) | |
tree | 68e8d10381432e34992ee9638cc3a262a82e622c /models/consistency.go | |
parent | b682a2c1b2d5efde24378858453903b5b89d6df8 (diff) | |
download | gitea-b9e281265ee2c510199cd0241ae02bff2bd8ecc1.tar.gz gitea-b9e281265ee2c510199cd0241ae02bff2bd8ecc1.zip |
Add migration to set IsArchived false if it is null (#11853)
* Add migration to set IsArchived false if it is null
Fix #11824
Signed-off-by: Andrew Thornton <art27@cantab.net>
* Add doctor
Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
Diffstat (limited to 'models/consistency.go')
-rw-r--r-- | models/consistency.go | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/models/consistency.go b/models/consistency.go index d6a158840b..fbb99ca80c 100644 --- a/models/consistency.go +++ b/models/consistency.go @@ -283,3 +283,15 @@ func DeleteOrphanedObjects(subject, refobject, joinCond string) error { Delete("`" + subject + "`") return err } + +// CountNullArchivedRepository counts the number of repositories with is_archived is null +func CountNullArchivedRepository() (int64, error) { + return x.Where(builder.IsNull{"is_archived"}).Count(new(Repository)) +} + +// 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{ + IsArchived: false, + }) +} |