FIX: Handle empty string in theme_settings for upload_references (#17047)

Follow up to 9db8f00b3d,
the theme_settings.value field is not an integer and so
can be '', we need to account for this in the migration
otherwise we get this error:

> PG::InvalidTextRepresentation: ERROR:  invalid input syntax for type integer: ""
This commit is contained in:
Martin Brennan 2022-06-09 18:19:44 +10:00 committed by GitHub
parent 946f8a65fd
commit 20f118c4c9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -7,7 +7,7 @@ class CopyThemeSettingsUploadsToUploadReferences < ActiveRecord::Migration[6.1]
SELECT theme_settings.value::int, 'ThemeSetting', theme_settings.id, uploads.created_at, uploads.updated_at
FROM theme_settings
JOIN uploads ON uploads.id = theme_settings.value::int
WHERE data_type = 6 AND theme_settings.value IS NOT NULL
WHERE data_type = 6 AND theme_settings.value IS NOT NULL AND theme_settings.value != ''
ON CONFLICT DO NOTHING
SQL
end