Skip to content

A platform for community discussion. Free, open, simple.

Don't raise error if a record already exists.

Vinoth Kannan8698a109205f
diff --git a/lib/tasks/posts.rake b/lib/tasks/posts.rake
index 0395c755bff..fe24d90e4b2 100644
--- a/lib/tasks/posts.rake
+++ b/lib/tasks/posts.rake
@@ -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