aboutsummaryrefslogtreecommitdiffstats
path: root/models/repo.go
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2021-06-14 10:22:55 +0800
committerGitHub <noreply@github.com>2021-06-14 10:22:55 +0800
commit0393a57511dc863bea4783fbb4b57cd11c41688a (patch)
treef479085c97ffe419e6fe02c88f6a2730a673fcb8 /models/repo.go
parenta005265718b840d34858a3b705f8133e1b4dbdbf (diff)
downloadgitea-0393a57511dc863bea4783fbb4b57cd11c41688a.tar.gz
gitea-0393a57511dc863bea4783fbb4b57cd11c41688a.zip
Add a new table issue_index to store the max issue index so that issue could be deleted with no duplicated index (#15599)
* Add a new table issue_index to store the max issue index so that issue could be deleted with no duplicated index * Fix pull index * Add tests for concurrent creating issues * Fix lint * Fix tests * Fix postgres test * Add test for migration v180 * Rename wrong test file name Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: Lauris BH <lauris@nix.lv>
Diffstat (limited to 'models/repo.go')
-rw-r--r--models/repo.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/models/repo.go b/models/repo.go
index 58a393ae70..532b7ae1f5 100644
--- a/models/repo.go
+++ b/models/repo.go
@@ -1510,6 +1510,11 @@ func DeleteRepository(doer *User, uid, repoID int64) error {
return err
}
+ // Delete issue index
+ if err := deleteResouceIndex(sess, "issue_index", repoID); err != nil {
+ return err
+ }
+
if repo.IsFork {
if _, err := sess.Exec("UPDATE `repository` SET num_forks=num_forks-1 WHERE id=?", repo.ForkID); err != nil {
return fmt.Errorf("decrease fork count: %v", err)