summaryrefslogtreecommitdiffstats
path: root/models/attachment.go
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2019-10-01 00:10:00 +0800
committerGitHub <noreply@github.com>2019-10-01 00:10:00 +0800
commit3249c0ccba5b3082fe60f4b571159016db6d57d7 (patch)
tree300f96f564ad68833a439c765defe347fbbcb350 /models/attachment.go
parentecd4bfd2844346e0f2af795d9815e2224556ef47 (diff)
downloadgitea-3249c0ccba5b3082fe60f4b571159016db6d57d7.tar.gz
gitea-3249c0ccba5b3082fe60f4b571159016db6d57d7.zip
Extract actions on deletereleasebyid from models to release service (#8219)
* extract actions on deletereleasebyid from models to release service * fix tests
Diffstat (limited to 'models/attachment.go')
-rw-r--r--models/attachment.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/models/attachment.go b/models/attachment.go
index 7fbf9dde99..a9032f1a86 100644
--- a/models/attachment.go
+++ b/models/attachment.go
@@ -255,3 +255,9 @@ func updateAttachment(e Engine, atta *Attachment) error {
_, err := sess.Cols("name", "issue_id", "release_id", "comment_id", "download_count").Update(atta)
return err
}
+
+// DeleteAttachmentsByRelease deletes all attachments associated with the given release.
+func DeleteAttachmentsByRelease(releaseID int64) error {
+ _, err := x.Where("release_id = ?", releaseID).Delete(&Attachment{})
+ return err
+}