about summary refs log tree commit diff
path: root/db/migrate/20190510071027_update_account_warning_action_enum.rb
blob: b89fb60d2df5cd507b4e91affd2a8659f08a2710 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
class UpdateAccountWarningActionEnum < ActiveRecord::Migration[5.2]
  disable_ddl_transaction!

  def up
    AccountWarning.where(action: :force_unlisted).each do |warning|
      warning.severity = :suspend
      warning.save
    end

    AccountWarning.where(action: :force_sensitive).each do |warning|
      warning.severity = :silence
      warning.save
    end
  end

  def down
    raise ActiveRecord::IrreversibleMigration
  end
end