mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: Skip invalid values in site setting upload references migration (#17138)
This commit is contained in:
@@ -4,9 +4,13 @@ class CopySiteSettingsUploadsToUploadReferences < ActiveRecord::Migration[6.1]
|
|||||||
def up
|
def up
|
||||||
execute <<~SQL
|
execute <<~SQL
|
||||||
WITH site_settings_uploads AS (
|
WITH site_settings_uploads AS (
|
||||||
SELECT id, unnest(string_to_array(value, '|'))::integer upload_id
|
SELECT id, raw_upload_id::integer AS upload_id
|
||||||
FROM site_settings
|
FROM (
|
||||||
WHERE data_type = 17
|
SELECT id, unnest(string_to_array(value, '|')) AS raw_upload_id
|
||||||
|
FROM site_settings
|
||||||
|
WHERE data_type = 17
|
||||||
|
) raw
|
||||||
|
WHERE raw_upload_id ~ '^\d+$'
|
||||||
UNION
|
UNION
|
||||||
SELECT id, value::integer
|
SELECT id, value::integer
|
||||||
FROM site_settings
|
FROM site_settings
|
||||||
|
|||||||
Reference in New Issue
Block a user