Class: CreateOpenHouses

Inherits:
ActiveRecord::Migration
  • Object
show all
Defined in:
lib/generators/reso/templates/create_open_houses.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
# File 'lib/generators/reso/templates/create_open_houses.rb', line 2

def change
  create_table :open_houses, options: 'DEFAULT CHARSET=utf8' do |t|
    t.date :showing_date

    # TODO: Does RESO provide a way to specify time zone?
    t.string :start_time
    t.string :end_time
    t.text :description
    t.references :listing, index: true, null: false, foreign_key: true

    t.timestamps
  end
  add_index :open_houses, :showing_date
  add_index :open_houses, :start_time
  add_index :open_houses, :end_time
end