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

  def up
    DomainBlock.where(severity: :force_unlisted).each do |block|
      block.severity = :suspend
      block.save
    end

    DomainBlock.where(severity: :noop).each do |block|
      block.severity = :silence
      block.save
    end
  end

  def down
    raise ActiveRecord::IrreversibleMigration
  end
end