summaryrefslogtreecommitdiff
path: root/db/migrate/20130404094648_add_amount_of_displayed_phone_numbers_to_switchboard.rb
diff options
context:
space:
mode:
authorStefan Wintermeyer <stefan.wintermeyer@amooma.de>2013-06-20 19:06:19 +0200
committerStefan Wintermeyer <stefan.wintermeyer@amooma.de>2013-06-20 19:06:19 +0200
commiteb0e1cc5c26275ff3e5c341404e8bc558f8312b8 (patch)
tree71f449ccd6f15422717de3ac24f87d5e888ddd79 /db/migrate/20130404094648_add_amount_of_displayed_phone_numbers_to_switchboard.rb
parentdf6e17e48995f25e72509986f30700d778b179b6 (diff)
parent3b27a5d45b12f6bac65da2a8e17387bfda42a2f1 (diff)
Merge branch 'develop'
Diffstat (limited to 'db/migrate/20130404094648_add_amount_of_displayed_phone_numbers_to_switchboard.rb')
-rw-r--r--db/migrate/20130404094648_add_amount_of_displayed_phone_numbers_to_switchboard.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/db/migrate/20130404094648_add_amount_of_displayed_phone_numbers_to_switchboard.rb b/db/migrate/20130404094648_add_amount_of_displayed_phone_numbers_to_switchboard.rb
new file mode 100644
index 0000000..2f88ad4
--- /dev/null
+++ b/db/migrate/20130404094648_add_amount_of_displayed_phone_numbers_to_switchboard.rb
@@ -0,0 +1,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