summaryrefslogtreecommitdiff
path: root/db/migrate/20180531220618_change_default_value_for_dsa_key_restriction.rb
blob: d0dcacc5b66c00a27530ad3f4eb180bb4f120b83 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
class ChangeDefaultValueForDsaKeyRestriction < ActiveRecord::Migration
  # Set this constant to true if this migration requires downtime.
  DOWNTIME = false

  def up
    change_column :application_settings, :dsa_key_restriction, :integer, null: false,
                  default: -1

    execute("UPDATE application_settings SET dsa_key_restriction = -1")
  end

  def down
    change_column :application_settings, :dsa_key_restriction, :integer, null: false,
                  default: 0
  end
end