summaryrefslogtreecommitdiff
path: root/db/migrate/20121228101454_update_tenant_id.rb
diff options
context:
space:
mode:
authorspag <spag@golwen.net>2012-12-29 17:42:35 +0100
committerspag <spag@golwen.net>2012-12-29 17:42:35 +0100
commit5cf46b6467679ea0367cc0c00787f6f1c86560e4 (patch)
treeb3f314d1ba574e328f1ce5a27aeadb6ae32980d5 /db/migrate/20121228101454_update_tenant_id.rb
parent929e7a391f139ed827e9bd3bea339789a82de6d4 (diff)
parent8d20201910b1915cffa495e6474d50f9c8e8331d (diff)
Merge branch 'develop' of github.com:amooma/GS5 into develop
Diffstat (limited to 'db/migrate/20121228101454_update_tenant_id.rb')
-rw-r--r--db/migrate/20121228101454_update_tenant_id.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/db/migrate/20121228101454_update_tenant_id.rb b/db/migrate/20121228101454_update_tenant_id.rb
new file mode 100644
index 0000000..dc2f37c
--- /dev/null
+++ b/db/migrate/20121228101454_update_tenant_id.rb
@@ -0,0 +1,16 @@
+class UpdateTenantId < ActiveRecord::Migration
+ def up
+ Phone.all.each do |phone|
+ phone.tenant_id = Tenant.last.id
+ phone.save
+ end
+
+ Phone.where(:hot_deskable => true).each do |phone|
+ phone.fallback_sip_account = phone.sip_accounts.where(:sip_accountable_type => 'Tenant').first
+ phone.save
+ end
+ end
+
+ def down
+ end
+end