discourse/db/migrate/20250702082232_deprecate_external_system_avatars_enabled.rb
David Taylor 1d5d9646c6
DEV: Promote old post-deploy migrations to pre-deploy (#38595)
This promotes all post-migrations which existed in `v2026.1` to regular
pre-deploy migrations. We do this after each stable/esr release to
reduce the probability of pre/post deploy timing issues.
2026-03-13 19:09:30 +00:00

21 lines
617 B
Ruby

# frozen_string_literal: true
class DeprecateExternalSystemAvatarsEnabled < ActiveRecord::Migration[7.2]
def up
execute <<~SQL
INSERT INTO site_settings(name, data_type, value, created_at, updated_at)
SELECT 'external_system_avatars_url', 1, '', 'NOW()', 'NOW()'
WHERE EXISTS (
SELECT 1
FROM site_settings
WHERE name = 'external_system_avatars_enabled'
AND value = 'f'
)
ON CONFLICT(name) DO UPDATE
SET value = EXCLUDED.value, updated_at = EXCLUDED.updated_at;
SQL
end
def down
raise ActiveRecord::IrreversibleMigration
end
end