diff options
author | 6543 <6543@obermui.de> | 2021-03-19 22:13:39 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-19 22:13:39 +0100 |
commit | 70e4134130331bda3bb1873c6099d8e63c468a2d (patch) | |
tree | 8f4966a9c664f7f940ea537c6df2a4a2d66683d1 /cmd | |
parent | 909f2be99d0c699f506f463bb6238378f12c0dc1 (diff) | |
download | gitea-70e4134130331bda3bb1873c6099d8e63c468a2d.tar.gz gitea-70e4134130331bda3bb1873c6099d8e63c468a2d.zip |
Delete Labels & IssueLabels on Repo Delete too (#15039) (#15051)
* Doctor: find IssueLabels without existing label
* Repo Delete: delete labels & issue_labels too
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 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 { |