summaryrefslogtreecommitdiff
path: root/db/migrate/20120119161152_snom_phones.rb
blob: 88c35f9f691d7b8814687f6efda6428e465d57be (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# ruby encoding: utf-8

class SnomPhones < ActiveRecord::Migration
  def up
  ################################################################
  # Manufacturers
  ################################################################
  add_column :phone_models, :uuid, :string rescue puts "column already added"
  snom = Manufacturer.find_or_create_by_ieee_name('SNOM Technology AG', 
            {
              :name => "SNOM Technology AG",
              :homepage_url => 'http://www.snom.com'
            }
          )


  ################################################################
  # OUIs
  ################################################################

  snom.ouis.find_or_create_by_value('000413')


  ################################################################
  # Phone models
  ################################################################

  snom300 = snom.phone_models.create(:name => 'Snom 300', 
                                    :product_homepage_url => 'http://www.snom.com/en/products/ip-phones/snom-300/',
                                    :product_manual_homepage_url => 'http://wiki.snom.com/Snom300/Documentation')

  snom320 = snom.phone_models.create(:name => 'Snom 320', 
                                :product_homepage_url => 'http://www.snom.com/en/products/ip-phones/snom-320/',
                                :product_manual_homepage_url => 'http://wiki.snom.com/Snom320/Documentation')

  snom360 = snom.phone_models.create(:name => 'Snom 360', 
                                :product_homepage_url => 'http://www.snom.com/en/products/ip-phones/snom-360/',
                                :product_manual_homepage_url => 'http://wiki.snom.com/Snom360/Documentation')

  snom370 = snom.phone_models.create(:name => 'Snom 370', 
                                :product_homepage_url => 'http://www.snom.com/en/products/ip-phones/snom-370/',
                                :product_manual_homepage_url => 'http://wiki.snom.com/Snom370/Documentation')

  snom820 = snom.phone_models.create(:name => 'Snom 820', 
                                :product_homepage_url => 'http://www.snom.com/en/products/ip-phones/snom-820/',
                                :product_manual_homepage_url => 'http://wiki.snom.com/Snom820/Documentation')
                                
  snom821 = snom.phone_models.create(:name => 'Snom 821', 
                                :product_homepage_url => 'http://www.snom.com/en/products/ip-phones/snom-821/',
                                :product_manual_homepage_url => 'http://wiki.snom.com/Snom821/Documentation')
                          
  snom870 = snom.phone_models.create(:name => 'Snom 870', 
                                :product_homepage_url => 'http://www.snom.com/en/products/ip-phones/snom-870/',
                                :product_manual_homepage_url => 'http://wiki.snom.com/Snom870/Documentation')                                                     

  end

  def down
    Manufacturer.destroy_all
    Oui.destroy_all
    PhoneModel.destroy_all
  end
end