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