summaryrefslogtreecommitdiffstats
path: root/cmd/doctor.go
diff options
context:
space:
mode:
authorzeripath <art27@cantab.net>2020-06-11 21:18:11 +0100
committerGitHub <noreply@github.com>2020-06-11 16:18:11 -0400
commitb9e281265ee2c510199cd0241ae02bff2bd8ecc1 (patch)
tree68e8d10381432e34992ee9638cc3a262a82e622c /cmd/doctor.go
parentb682a2c1b2d5efde24378858453903b5b89d6df8 (diff)
downloadgitea-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 'cmd/doctor.go')
-rw-r--r--cmd/doctor.go16
1 files changed, 16 insertions, 0 deletions
diff --git a/cmd/doctor.go b/cmd/doctor.go
index 3456f26f70..45a50c8266 100644
--- a/cmd/doctor.go
+++ b/cmd/doctor.go
@@ -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