diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2021-08-31 09:18:15 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-30 21:18:15 -0400 |
commit | 8d7704b5a2f7a0c7425a32bbc875fed15f515b4a (patch) | |
tree | 04dd5badfbe842e5d2c6b77720282ede5b828c8b /models | |
parent | c0f5da3e1adfe40cafc57de63948ef1878bd75c9 (diff) | |
download | gitea-8d7704b5a2f7a0c7425a32bbc875fed15f515b4a.tar.gz gitea-8d7704b5a2f7a0c7425a32bbc875fed15f515b4a.zip |
Fix dump and restore respository (#16698)
* Fix dump and restore
* return different error message for get commit
* Fix missing delete release attachment when deleting repository
* Fix ci and add some comments
Co-authored-by: zeripath <art27@cantab.net>
Diffstat (limited to 'models')
-rw-r--r-- | models/repo.go | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/models/repo.go b/models/repo.go index c3f93f3562..94af318789 100644 --- a/models/repo.go +++ b/models/repo.go @@ -1497,6 +1497,11 @@ func DeleteRepository(doer *User, uid, repoID int64) error { releaseAttachments = append(releaseAttachments, attachments[i].RelativePath()) } + if _, err = sess.In("release_id", builder.Select("id").From("`release`").Where(builder.Eq{"`release`.repo_id": repoID})). + Delete(&Attachment{}); err != nil { + return err + } + if _, err := sess.Exec("UPDATE `user` SET num_stars=num_stars-1 WHERE id IN (SELECT `uid` FROM `star` WHERE repo_id = ?)", repo.ID); err != nil { return err } |