FIX: Handle invalid JSON from downloaded_images custom fields (#16613)
custom_field data on some sites has duplicate values for a given url key in the JSON value. This is invalid, so we should drop the extra data.
This commit is contained in:
parent
175e6e6061
commit
1c9d8b4999
|
@ -46,6 +46,7 @@ class CreatePostHotlinkedMedia < ActiveRecord::Migration[6.1]
|
||||||
JOIN json_each_text(pcf.value::json) obj ON true
|
JOIN json_each_text(pcf.value::json) obj ON true
|
||||||
JOIN uploads ON obj.value::bigint = uploads.id
|
JOIN uploads ON obj.value::bigint = uploads.id
|
||||||
WHERE name='downloaded_images'
|
WHERE name='downloaded_images'
|
||||||
|
ON CONFLICT (post_id, md5(url::text)) DO NOTHING
|
||||||
SQL
|
SQL
|
||||||
|
|
||||||
execute <<~SQL
|
execute <<~SQL
|
||||||
|
|
Loading…
Reference in New Issue