discourse-cakeday/db/migrate/20250811132217_persist_cakeday_birthday_enabled.rb
Jarek Radosz 6e77a5e1d5
DEV: Persist the current value of cakeday_birthday_enabled (#166)
…so that the default could be changed in the future.

(similar to 2325c95ece)
2025-08-11 16:06:34 +02:00

17 lines
543 B
Ruby

# frozen_string_literal: true
# TODO: Comment this migration out when merging the plugin into core
class PersistCakedayBirthdayEnabled < ActiveRecord::Migration[8.0]
def up
# 5 is bool data_type
DB.exec(<<~SQL, value: SiteSetting.cakeday_birthday_enabled ? "t" : "f")
INSERT INTO site_settings(name, data_type, value, created_at, updated_at)
VALUES('cakeday_birthday_enabled', 5, :value, NOW(), NOW())
ON CONFLICT (name) DO NOTHING
SQL
end
def down
raise ActiveRecord::IrreversibleMigration
end
end