Skip to content

A platform for community discussion. Free, open, simple.

FIX: correct mailing list migration (#12501)

Samc47f403dd9dc
diff --git a/db/migrate/20210315173137_set_disable_mailing_list_mode.rb b/db/migrate/20210315173137_set_disable_mailing_list_mode.rb
index 08872bc7936..83abd1d93d4 100644
--- a/db/migrate/20210315173137_set_disable_mailing_list_mode.rb
+++ b/db/migrate/20210315173137_set_disable_mailing_list_mode.rb
@@ -7,15 +7,12 @@ class SetDisableMailingListMode < ActiveRecord::Migration[6.0]
execute <<~SQL
INSERT INTO site_settings(name, data_type, value, created_at, updated_at)
VALUES('disable_mailing_list_mode', 5, 'f', NOW(), NOW())
- ON CONFLICT (name) DO UPDATE SET value = 'f'
+ ON CONFLICT (name) DO NOTHING
SQL
end
end
def down
- result = execute "SELECT COUNT(*) FROM user_options WHERE mailing_list_mode"
- if result.first['count'] == 0
- execute "DELETE FROM site_settings WHERE name = 'disable_mailing_list_mode'"
- end
+ raise ActiveRecord::IrreversibleMigration
end
end