summaryrefslogtreecommitdiff
path: root/db/migrate/20130404094648_add_amount_of_displayed_phone_numbers_to_switchboard.rb
blob: 2f88ad449cefbd4e9d47197a35cbf33b12d4511a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
class AddAmountOfDisplayedPhoneNumbersToSwitchboard < ActiveRecord::Migration
  def up
    add_column :switchboards, :amount_of_displayed_phone_numbers, :integer

    # Set a default for existing entries of 
    # 1 for amount_of_displayed_phone_numbers
    #
    Switchboard.all.each do |switchboard|
      switchboard.amount_of_displayed_phone_numbers = 1
      switchboard.save
    end
  end

  def down
    remove_column :switchboards, :amount_of_displayed_phone_numbers, :integer
  end
end