diff options
Diffstat (limited to 'models/issue_label.go')
-rw-r--r-- | models/issue_label.go | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/models/issue_label.go b/models/issue_label.go index 54b286fe7e..6d519aa8cd 100644 --- a/models/issue_label.go +++ b/models/issue_label.go @@ -764,3 +764,15 @@ func DeleteIssueLabel(issue *Issue, label *Label, doer *User) (err error) { return sess.Commit() } + +func deleteLabelsByRepoID(sess Engine, repoID int64) error { + deleteCond := builder.Select("id").From("label").Where(builder.Eq{"label.repo_id": repoID}) + + if _, err := sess.In("label_id", deleteCond). + Delete(&IssueLabel{}); err != nil { + return err + } + + _, err := sess.Delete(&Label{RepoID: repoID}) + return err +} |