discourse/db/migrate/20220505133851_migrate_custom_group_deletion_logs.rb
Roman Rizzi 6bdcd7afb2
FEATURE: Promote the "delete group" staff action log. (#16656)
We used to log group deletion as custom, which means we can't later search for them. Include group ID in the details.
2022-05-09 12:12:52 -03:00

15 lines
410 B
Ruby

# frozen_string_literal: true
class MigrateCustomGroupDeletionLogs < ActiveRecord::Migration[7.0]
def up
DB.exec(<<~SQL, group_deleted_id: 99, custom_action_id: 23)
UPDATE user_histories
SET action = :group_deleted_id, custom_type = NULL
WHERE action = :custom_action_id AND custom_type = 'delete_group'
SQL
end
def down
raise ActiveRecord::IrreversibleMigration
end
end