mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 02:21:18 +08:00
Don't raise error if a record already exists.
This commit is contained in:
@ -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
|
||||
|
Reference in New Issue
Block a user