diff options
Diffstat (limited to 'cmd/doctor.go')
-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 5ba0451110..3c271f131f 100644 --- a/cmd/doctor.go +++ b/cmd/doctor.go @@ -606,6 +606,22 @@ func runDoctorCheckDBConsistency(ctx *cli.Context) ([]string, error) { } } + // find IssueLabels without existing label + count, err = models.CountOrphanedIssueLabels() + if err != nil { + return nil, err + } + if count > 0 { + if ctx.Bool("fix") { + if err = models.DeleteOrphanedIssueLabels(); err != nil { + return nil, err + } + results = append(results, fmt.Sprintf("%d issue_labels without existing label deleted", count)) + } else { + results = append(results, fmt.Sprintf("%d issue_labels without existing label", count)) + } + } + //find issues without existing repository count, err = models.CountOrphanedIssues() if err != nil { |