Class: CreateHasVcards

Inherits:
ActiveRecord::Migration
  • Object
show all
Defined in:
lib/generators/has_vcards/templates/migration.rb

Class Method Summary collapse

Class Method Details

.downObject



46
47
48
# File 'lib/generators/has_vcards/templates/migration.rb', line 46

def self.down
  drop_table :vcards, :phone_numbers, :addresses
end

.upObject



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
# File 'lib/generators/has_vcards/templates/migration.rb', line 2

def self.up
  create_table 'addresses', :force => true do |t|
    t.string  'post_office_box',  :limit => 50
    t.string  'extended_address', :limit => 50
    t.string  'street_address',   :limit => 50
    t.string  'locality',         :limit => 50
    t.string  'region',           :limit => 50
    t.string  'postal_code',      :limit => 50
    t.string  'country_name',     :limit => 50
    t.integer 'vcard_id'
    t.string  'address_type'
  end

  add_index 'addresses', ['vcard_id'], :name => 'addresses_vcard_id_index'

  create_table 'phone_numbers', :force => true do |t|
    t.string  'number',            :limit => 50
    t.string  'phone_number_type', :limit => 50
    t.integer 'vcard_id'
    t.integer 'object_id'
    t.string  'object_type'
  end

  add_index 'phone_numbers', ['object_id', 'object_type'],  :name => 'index_phone_numbers_on_object_id_and_object_type'
  add_index 'phone_numbers', ['phone_number_type'],         :name => 'index_phone_numbers_on_phone_number_type'
  add_index 'phone_numbers', ['vcard_id'],                  :name => 'phone_numbers_vcard_id_index'

  create_table 'vcards', :force => true do |t|
    t.string  'full_name',        :limit => 50
    t.string  'nickname',         :limit => 50
    t.string  'family_name',      :limit => 50
    t.string  'given_name',       :limit => 50
    t.string  'additional_name',  :limit => 50
    t.string  'honorific_prefix', :limit => 50
    t.string  'honorific_suffix', :limit => 50
    t.boolean 'active',           :default => true
    t.string  'type'
    t.integer 'object_id'
    t.string  'object_type'
  end

  add_index 'vcards', ['object_id', 'object_type'], :name => 'index_vcards_on_object_id_and_object_type'
end