mirror of
https://github.com/discourse/discourse.git
synced 2025-03-27 20:38:09 +08:00
FIX: Skip invalid values in site setting upload references migration (#17138)
This commit is contained in:
parent
7ac485fb9f
commit
410ab5d587
@ -4,9 +4,13 @@ class CopySiteSettingsUploadsToUploadReferences < ActiveRecord::Migration[6.1]
|
||||
def up
|
||||
execute <<~SQL
|
||||
WITH site_settings_uploads AS (
|
||||
SELECT id, unnest(string_to_array(value, '|'))::integer upload_id
|
||||
FROM site_settings
|
||||
WHERE data_type = 17
|
||||
SELECT id, raw_upload_id::integer AS upload_id
|
||||
FROM (
|
||||
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
|
||||
SELECT id, value::integer
|
||||
FROM site_settings
|
||||
|
Loading…
x
Reference in New Issue
Block a user