mirror of
				https://github.com/go-gitea/gitea
				synced 2025-10-31 11:28:24 +00:00 
			
		
		
		
	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
This commit is contained in:
		| @@ -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 { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user