mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 08:53:41 +08:00
25138db433
This commit promotes all post_deploy migrations which existed in Discourse v3.0.0 (timestamp <= 20221212234948)
32 lines
925 B
Ruby
32 lines
925 B
Ruby
# frozen_string_literal: true
|
|
|
|
class MigrateSelectableAvatarsEnabled < ActiveRecord::Migration[6.1]
|
|
def up
|
|
execute <<~SQL
|
|
UPDATE site_settings AS s
|
|
SET value =
|
|
CASE WHEN t.value = 't' THEN 'no_one'
|
|
ELSE 'disabled'
|
|
END,
|
|
data_type = #{SiteSettings::TypeSupervisor.types[:enum]},
|
|
name = 'selectable_avatars_mode'
|
|
FROM site_settings t
|
|
WHERE s.id = t.id AND s.name = 'selectable_avatars_enabled'
|
|
SQL
|
|
end
|
|
|
|
def down
|
|
execute <<~SQL
|
|
UPDATE site_settings AS s
|
|
SET value =
|
|
CASE WHEN t.value IN ('everyone', 'no_one', 'staff', 'tl1','tl2', 'tl3', 'tl4') THEN 't'
|
|
ELSE 'f'
|
|
END,
|
|
data_type = #{SiteSettings::TypeSupervisor.types[:bool]},
|
|
name = 'selectable_avatars_enabled'
|
|
FROM site_settings t
|
|
WHERE s.id = t.id AND s.name = 'selectable_avatars_mode'
|
|
SQL
|
|
end
|
|
end
|