2019-05-02 17:17:27 -05:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-02-26 14:48:59 -06:00
|
|
|
class RemoveCensoredPatternSiteSetting < ActiveRecord::Migration[5.1]
|
|
|
|
def up
|
|
|
|
execute <<~SQL
|
|
|
|
INSERT INTO user_histories
|
|
|
|
(action, acting_user_id, subject, previous_value,
|
|
|
|
new_value, admin_only, created_at, updated_at)
|
|
|
|
SELECT 3, -1, 'censored_pattern', value, '', true, now(), now()
|
|
|
|
FROM site_settings
|
|
|
|
WHERE name = 'censored_pattern'
|
|
|
|
AND value != ''
|
|
|
|
SQL
|
|
|
|
|
|
|
|
execute "DELETE FROM site_settings WHERE name = 'censored_pattern'"
|
|
|
|
end
|
|
|
|
|
|
|
|
def down
|
|
|
|
raise ActiveRecord::IrreversibleMigration
|
|
|
|
end
|
|
|
|
end
|