summaryrefslogtreecommitdiff
path: root/db/migrate/20121228101454_update_tenant_id.rb
blob: dc2f37c77e9d11c195b69d5b1e52381a4786527f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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