mirror of
https://gh.wpcy.net/https://github.com/discourse/discourse.git
synced 2026-05-05 07:03:37 +08:00
This commit removes the value transformers introduced to Horizon back in274e5f7a1fand897d34132ein favor of the new themeable site settings introduced in19af83d39e, as this is what they are for. No migration for existing sites...they will already have ThemeSiteSetting values from a previous migration to ensure site setting values were preserved in theme site settings. We do delete the ThemeField storing the Horizon custom theme setting definition though, otherwise the UI still shows the old settings.
27 lines
705 B
Ruby
27 lines
705 B
Ruby
# frozen_string_literal: true
|
|
class DropHorizonSettingField < ActiveRecord::Migration[8.0]
|
|
def up
|
|
old_setting_field_id = DB.query_single(<<~SQL).first
|
|
SELECT id FROM theme_fields
|
|
WHERE theme_id = -2 AND name = 'yaml' AND target_id = 3
|
|
SQL
|
|
|
|
return if old_setting_field_id.nil?
|
|
|
|
# target_id 3 is Theme.targets[:settings]
|
|
# ID -2 is always the Horizon theme since it's a core theme
|
|
DB.exec(<<~SQL)
|
|
DELETE FROM theme_fields
|
|
WHERE id = #{old_setting_field_id}
|
|
SQL
|
|
|
|
DB.exec(<<~SQL)
|
|
DELETE FROM javascript_caches
|
|
WHERE theme_field_id = #{old_setting_field_id}
|
|
SQL
|
|
end
|
|
|
|
def down
|
|
raise ActiveRecord::IrreversibleMigration
|
|
end
|
|
end
|