mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-06-20 17:57:14 -04:00
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>
This commit is contained in:
parent
b682a2c1b2
commit
b9e281265e
4 changed files with 55 additions and 1 deletions
|
@ -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,
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue