diff options
author | zeripath <art27@cantab.net> | 2020-06-11 22:08:13 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-11 17:08:13 -0400 |
commit | f2bde408049bed98ecedc4c1d73abf9639f34d76 (patch) | |
tree | 7d8bb4755b609bd06ec468793a03528d35499258 /cmd | |
parent | 6b1e5f7f88d13bb651de715bc3f447df94b9d6a3 (diff) | |
download | gitea-f2bde408049bed98ecedc4c1d73abf9639f34d76.tar.gz gitea-f2bde408049bed98ecedc4c1d73abf9639f34d76.zip |
Add doctor check to set IsArchived false if it is null (partial backport #11853) (#11859)
Partial backport of #11853
Add doctor check to set IsArchived false if it is null.
(Migration change unfortunately not possible to be backported.)
Fix #11824
Signed-off-by: Andrew Thornton <art27@cantab.net>
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/doctor.go | 16 |
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 |