Skip to content

Commit

Permalink
Delete dependencies when deleting a repository (#10608) (#10616)
Browse files Browse the repository at this point in the history
Co-authored-by: zeripath <art27@cantab.net>
Co-authored-by: Lauris BH <lauris@nix.lv>

Co-authored-by: Lauris BH <lauris@nix.lv>
Co-authored-by: zeripath <art27@cantab.net>
  • Loading branch information
zeripath and lafriks authored Mar 5, 2020
1 parent fd85d31 commit c19ac41
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions models/repo.go
Original file line number Diff line number Diff line change
Expand Up @@ -1856,6 +1856,18 @@ func DeleteRepository(doer *User, uid, repoID int64) error {
return err
}

// Dependencies for issues in this repository
if _, err = sess.In("issue_id", deleteCond).
Delete(&IssueDependency{}); err != nil {
return err
}

// Delete dependencies for issues in other repositories
if _, err = sess.In("dependency_id", deleteCond).
Delete(&IssueDependency{}); err != nil {
return err
}

if _, err = sess.In("issue_id", deleteCond).
Delete(&IssueUser{}); err != nil {
return err
Expand Down

0 comments on commit c19ac41

Please sign in to comment.