Class: CreatePlaces

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

Instance Method Summary collapse

Instance Method Details

#changeObject



2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/generators/reso/templates/create_places.rb', line 2

def change
  create_table :places, options: 'DEFAULT CHARSET=utf8' do |t|
    t.string :name, null: false
    t.string :city
    t.string :state_or_province
    t.string :country, null: false, default: "US"
    t.string :type, null: false
    t.text :description

    t.timestamps
  end
  add_index :places, :name
  add_index :places, :city
  add_index :places, :state_or_province
  add_index :places, :country
  add_index :places, :type
  add_index :places, [:name, :state_or_province, :country]
end