diff options
author | 6543 <6543@obermui.de> | 2022-05-08 15:46:34 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-08 15:46:34 +0200 |
commit | 6a969681cd862bf153fa7921485278be1e8a092a (patch) | |
tree | f9a23ee85652c0ee179f215b23d928058176ae6c /models/repo.go | |
parent | 4344a6410788f30848e5153f6356dcdd0774bebc (diff) | |
download | gitea-6a969681cd862bf153fa7921485278be1e8a092a.tar.gz gitea-6a969681cd862bf153fa7921485278be1e8a092a.zip |
Delete related PullAutoMerge and ReviewState on User/Repo Deletion (#19649)
* delete pullautomerges on repo/user deletion
* delete reviewstates on repo/user deletion
* optimize automerhe code
* add index to reviewstate
Diffstat (limited to 'models/repo.go')
-rw-r--r-- | models/repo.go | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/models/repo.go b/models/repo.go index fbc766850d..e20bf90d97 100644 --- a/models/repo.go +++ b/models/repo.go @@ -704,7 +704,6 @@ func DeleteRepository(doer *user_model.User, uid, repoID int64) error { &Notification{RepoID: repoID}, &ProtectedBranch{RepoID: repoID}, &ProtectedTag{RepoID: repoID}, - &PullRequest{BaseRepoID: repoID}, &repo_model.PushMirror{RepoID: repoID}, &Release{RepoID: repoID}, &repo_model.RepoIndexerStatus{RepoID: repoID}, @@ -723,6 +722,11 @@ func DeleteRepository(doer *user_model.User, uid, repoID int64) error { return err } + // Delete Pulls and related objects + if err := deletePullsByBaseRepoID(sess, repoID); err != nil { + return err + } + // Delete Issues and related objects var attachmentPaths []string if attachmentPaths, err = deleteIssuesByRepoID(sess, repoID); err != nil { |