FIX: Destroy optimized images in upload:migrate_to_s3 rake task.

`OptimizedImage` are currently not renegerated when the image changes
store.
This commit is contained in:
Guo Xiang Tan 2019-03-21 16:40:31 +08:00
parent fdd2e7f2e7
commit 4e594f2b2b

View File

@ -378,6 +378,11 @@ def migrate_to_s3
else
DbHelper.remap(from, to)
end
OptimizedImage
.joins("LEFT JOIN uploads u ON optimized_images.upload_id = u.id")
.where("u.id IS NOT NULL AND u.url LIKE '//%' AND optimized_images.url NOT LIKE '//%'")
.destroy_all
end
puts "Done!"