Class: CreatePrices

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

def change
  create_table :prices, options: 'DEFAULT CHARSET=utf8' do |t|
    t.references  :listing, index: true, null: false, foreign_key: true
    t.references  :currency_period, index: true

    t.string :type, null: false
    t.integer     :list_price, limit: 8
    t.string      :currency_code, default: "USD"
    t.integer     :list_price_low, limit: 8
    t.string      :currency_code_low, default: "USD"

    t.timestamps
  end
  add_index :prices, [:list_price, :currency_code]
  add_index :prices, :list_price
  add_index :prices, :type
end