summaryrefslogtreecommitdiffstats
path: root/models/repo.go
diff options
context:
space:
mode:
Diffstat (limited to 'models/repo.go')
-rw-r--r--models/repo.go32
1 files changed, 15 insertions, 17 deletions
diff --git a/models/repo.go b/models/repo.go
index 0a0f725f09..daa94c0d50 100644
--- a/models/repo.go
+++ b/models/repo.go
@@ -1455,24 +1455,26 @@ func DeleteRepository(doer *User, uid, repoID int64) error {
if err := deleteBeans(sess,
&Access{RepoID: repo.ID},
&Action{RepoID: repo.ID},
- &Watch{RepoID: repoID},
- &Star{RepoID: repoID},
- &Mirror{RepoID: repoID},
- &Milestone{RepoID: repoID},
- &Release{RepoID: repoID},
&Collaboration{RepoID: repoID},
- &PullRequest{BaseRepoID: repoID},
- &RepoUnit{RepoID: repoID},
- &RepoRedirect{RedirectRepoID: repoID},
- &Webhook{RepoID: repoID},
+ &Comment{RefRepoID: repoID},
+ &CommitStatus{RepoID: repoID},
+ &DeletedBranch{RepoID: repoID},
&HookTask{RepoID: repoID},
+ &LFSLock{RepoID: repoID},
+ &LanguageStat{RepoID: repoID},
+ &Milestone{RepoID: repoID},
+ &Mirror{RepoID: repoID},
&Notification{RepoID: repoID},
- &CommitStatus{RepoID: repoID},
+ &ProtectedBranch{RepoID: repoID},
+ &PullRequest{BaseRepoID: repoID},
+ &Release{RepoID: repoID},
&RepoIndexerStatus{RepoID: repoID},
- &LanguageStat{RepoID: repoID},
- &Comment{RefRepoID: repoID},
+ &RepoRedirect{RedirectRepoID: repoID},
+ &RepoUnit{RepoID: repoID},
+ &Star{RepoID: repoID},
&Task{RepoID: repoID},
- &ProtectedBranch{RepoID: repoID},
+ &Watch{RepoID: repoID},
+ &Webhook{RepoID: repoID},
); err != nil {
return fmt.Errorf("deleteBeans: %v", err)
}
@@ -1488,10 +1490,6 @@ func DeleteRepository(doer *User, uid, repoID int64) error {
return err
}
- if _, err := sess.Where("repo_id = ?", repoID).Delete(new(RepoUnit)); 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)