summaryrefslogtreecommitdiff
path: root/db/to-dos/20120223142004_add_more_german_area_codes.rb
blob: 2eb25548f588066bb04065591c80890932c94595 (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
# encoding: UTF-8

class AddMoreGermanAreaCodes < ActiveRecord::Migration
  def up
    # http://www.bundesnetzagentur.de/cln_1912/DE/Sachgebiete/Telekommunikation/RegulierungTelekommunikation/Nummernverwaltung/Nummernverwaltung_node.html

    germany = Country.find_by_name('Germany')
    german_service_number_range = germany.phone_number_ranges.find_by_name('service_numbers')

    # Harmonisierte Dienste von sozialem Wert
    #
    (0..9).each do |x|
      (0..9).each do |y|
        (0..9).each do |z|
          german_service_number_range.phone_numbers.create( 
                            :name => "Harmonisierte Dienste von sozialem Wert", 
                            :number => "116#{x}#{y}#{z}" 
                                                          )
        end
      end
    end 

    # Auskunftsdienste
    #
    (0..9).each do |x|
      (0..9).each do |y|
          german_service_number_range.phone_numbers.create( 
                            :name => "Auskunftsdienste", 
                            :number => "118#{x}#{y}" 
                                                          )
      end
    end

    # Online-Dienste
    #
    (0..9).each do |x|
      (0..9).each do |y|
        (0..9).each do |z|
          AreaCode.create( 
                           :country_id => germany.id, 
                           :name => 'Online-Dienste', 
                           :area_code => "19#{x}#{y}#{z}"
                         )
        end
      end
    end

    AreaCode.create(:country_id => germany.id, :name => 'Neuartige Dienste', :area_code => '12')
    AreaCode.create(:country_id => germany.id, :name => 'Massenverkehrs-Dienste', :area_code => '137')
    AreaCode.create(:country_id => germany.id, :name => 'Nutzergruppen', :area_code => '18')
    AreaCode.create(:country_id => germany.id, :name => 'Internationale Virtuelle Private Netze', :area_code => '181')
    AreaCode.create(:country_id => germany.id, :name => 'Nationale Teilnehmernummern', :area_code => '32')
    AreaCode.create(:country_id => germany.id, :name => 'Anwählprogramme (Dialer)', :area_code => '9009')
  end

  def down
  end
end