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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
*_create_posts.rb:

class CreatePosts < ActiveRecord::Migration
  def self.up
    create_table :posts do |t|
      t.text :message

      t.timestamps
    end
  end

  def self.down
    drop_table :posts
  end
end

*_create_users.rb:

class CreateUsers < ActiveRecord::Migration
  def self.up
    create_table :users do |t|
      t.string :username
      t.string :email
      t.string :crypted_password
      t.string :password_salt
      t.string :persistence_token
      t.timestamps
    end
  end

  def self.down
    drop_table :users
  end
end

*_create_entries.rb:

class CreateEntries < ActiveRecord::Migration
  def self.up
    create_table :entries do |t|
      t.string :name
      t.string :address
      t.string :phone
      t.string :phone2
      t.string :mobile
      t.string :fax
      t.string :email
      t.string :website
      t.string :category
      t.text   :description

      t.timestamps
    end
  end

  def self.down
    drop_table :entries
  end
end

*_add_live_to_entry.rb:

class AddLiveToEntry < ActiveRecord::Migration
  def self.up
    add_column :entries, :live, :boolean, :default => false, :null => false
  end

  def self.down
    remove_column :entries, :live
  end
end

*_add_paddress_to_entry.rb:

class AddPaddressToEntry < ActiveRecord::Migration
  def self.up
    add_column :entries, :paddress, :string
  end

  def self.down
    remove_column :entries, :paddress
  end
end

*_add_tollfreephone_to_entry.rb:

class AddTollfreephoneToEntry < ActiveRecord::Migration
  def self.up
    add_column :entries, :tollfreephone, :string
  end

  def self.down
    remove_column :entries, :tollfreephone
  end
end

*_add_acts_as_taggable_on_migration.rb:

class ActsAsTaggableOnMigration < ActiveRecord::Migration
  def self.up
    create_table :tags do |t|
      t.column :name, :string
    end

    create_table :taggings do |t|
      t.column :tag_id, :integer
      t.column :taggable_id, :integer
      t.column :tagger_id, :integer
      t.column :tagger_type, :string

      # You should make sure that the column created is
      # long enough to store the required class names.
      t.column :taggable_type, :string
      t.column :context, :string

      t.column :created_at, :datetime
    end

    add_index :taggings, :tag_id
    add_index :taggings, [:taggable_id, :taggable_type, :context]
  end

  def self.down
    drop_table :taggings
    drop_table :tags
  end
end

*_add_geo_to_entries.rb:

class AddGeoToEntries < ActiveRecord::Migration
  def self.up
    add_column :entries, :lat, :float
    add_column :entries, :lng, :float
  end

  def self.down
    remove_column :entries, :lat
    remove_column :entries, :lng
  end
end