summaryrefslogtreecommitdiff
path: root/db/migrate
diff options
context:
space:
mode:
authorStefan Wintermeyer <stefan.wintermeyer@amooma.de>2013-04-04 12:04:34 +0200
committerStefan Wintermeyer <stefan.wintermeyer@amooma.de>2013-04-04 12:04:34 +0200
commitd6a733440eee34dab3daf25089d40aed91018a49 (patch)
tree632e46e34a4338a6e3b4f7cb2c29c123f50a4ea9 /db/migrate
parentcea2cc3c1cc1e48fc4600c698d52dfda2bde4505 (diff)
Limit the amount of displayed phone_numbers in a switchboard_entry
Diffstat (limited to 'db/migrate')
-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