diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2021-09-08 23:19:30 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-08 17:19:30 +0200 |
commit | ddc709ff7f94bd627ac05209a16ea5a5e24b7413 (patch) | |
tree | 1420d827e00769c1a8330c6b1a80e7cbbc343332 /models/context.go | |
parent | f55cd033ed8dbee04e90faede5cca2dcf697e102 (diff) | |
download | gitea-ddc709ff7f94bd627ac05209a16ea5a5e24b7413.tar.gz gitea-ddc709ff7f94bd627ac05209a16ea5a5e24b7413.zip |
Add repo_id for attachment (#16958)
When create a new issue or comment and paste/upload an attachment/image, it will not assign an issue id before submit. So if user give up the creating, the attachments will lost key feature and become dirty content. We don't know if we need to delete the attachment even if the repository deleted.
This PR add a repo_id in attachment table so that even if a new upload attachment with no issue_id or release_id but should have repo_id. When deleting a repository, they could also be deleted.
Co-authored-by: 6543 <6543@obermui.de>
Diffstat (limited to 'models/context.go')
-rw-r--r-- | models/context.go | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/models/context.go b/models/context.go index 1221ab7ded..a074d06834 100644 --- a/models/context.go +++ b/models/context.go @@ -66,3 +66,9 @@ func Iterate(ctx DBContext, tableBean interface{}, cond builder.Cond, fun func(i BufferSize(setting.Database.IterateBufferSize). Iterate(tableBean, fun) } + +// Insert inserts records into database +func Insert(ctx DBContext, beans ...interface{}) error { + _, err := ctx.e.Insert(beans...) + return err +} |