mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 01:42:04 +08:00
Don't raise error if a record already exists.
This commit is contained in:
parent
5a70367a05
commit
8698a10920
|
@ -472,7 +472,8 @@ task 'posts:missing_uploads' => :environment do
|
|||
end
|
||||
|
||||
if upload_id.present?
|
||||
PostUpload.create!(post_id: post.id, upload_id: upload_id)
|
||||
attributes = { post_id: post.id, upload_id: upload_id }
|
||||
PostUpload.create!(attributes) unless PostUpload.exists?(attributes)
|
||||
else
|
||||
missing_uploads << src
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue
Block a user