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
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue