mirror of
https://github.com/discourse/discourse.git
synced 2025-04-27 04:54:30 +08:00
FIX: correct mailing list migration (#12501)
Migration mistakenly enabled mailing list mode after it was disabled explicitly
This commit is contained in:
parent
5a1318e3c3
commit
c47f403dd9
@ -7,15 +7,12 @@ class SetDisableMailingListMode < ActiveRecord::Migration[6.0]
|
|||||||
execute <<~SQL
|
execute <<~SQL
|
||||||
INSERT INTO site_settings(name, data_type, value, created_at, updated_at)
|
INSERT INTO site_settings(name, data_type, value, created_at, updated_at)
|
||||||
VALUES('disable_mailing_list_mode', 5, 'f', NOW(), NOW())
|
VALUES('disable_mailing_list_mode', 5, 'f', NOW(), NOW())
|
||||||
ON CONFLICT (name) DO UPDATE SET value = 'f'
|
ON CONFLICT (name) DO NOTHING
|
||||||
SQL
|
SQL
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def down
|
def down
|
||||||
result = execute "SELECT COUNT(*) FROM user_options WHERE mailing_list_mode"
|
raise ActiveRecord::IrreversibleMigration
|
||||||
if result.first['count'] == 0
|
|
||||||
execute "DELETE FROM site_settings WHERE name = 'disable_mailing_list_mode'"
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user