A platform for community discussion. Free, open, simple.
FIX: Handle duplicates in hotlinked_media migration (#16611)
David Taylorbebb4fd11181
diff --git a/db/migrate/20220428094026_create_post_hotlinked_media.rb b/db/migrate/20220428094026_create_post_hotlinked_media.rbindex cc868310451..b34e363725f 100644--- a/db/migrate/20220428094026_create_post_hotlinked_media.rb+++ b/db/migrate/20220428094026_create_post_hotlinked_media.rb@@ -60,6 +60,7 @@ class CreatePostHotlinkedMedia < ActiveRecord::Migration[6.1]FROM post_custom_fields pcfJOIN json_array_elements_text(pcf.value::json) url ON trueWHERE name='broken_images'+ ON CONFLICT (post_id, md5(url::text)) DO NOTHINGSQLexecute <<~SQL@@ -74,6 +75,7 @@ class CreatePostHotlinkedMedia < ActiveRecord::Migration[6.1]FROM post_custom_fields pcfJOIN json_array_elements_text(pcf.value::json) url ON trueWHERE name='large_images'+ ON CONFLICT (post_id, md5(url::text)) DO NOTHINGSQLendend