1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-22 18:28:37 +00: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:
zeripath
2020-06-11 21:18:11 +01:00
committed by GitHub
parent b682a2c1b2
commit b9e281265e
4 changed files with 55 additions and 1 deletions

View File

@@ -574,6 +574,22 @@ func runDoctorCheckDBConsistency(ctx *cli.Context) ([]string, error) {
}
}
count, err = models.CountNullArchivedRepository()
if err != nil {
return nil, err
}
if count > 0 {
if ctx.Bool("fix") {
updatedCount, err := models.FixNullArchivedRepository()
if err != nil {
return nil, err
}
results = append(results, fmt.Sprintf("%d repositories with null is_archived updated", updatedCount))
} else {
results = append(results, fmt.Sprintf("%d repositories with null is_archived", count))
}
}
//ToDo: function to recalc all counters
return results, nil