Class: CreateLineItems

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

Class Method Summary collapse

Class Method Details

.downObject



18
19
20
# File 'lib/generators/templates/create_line_items.rb', line 18

def self.down
  drop_table :line_items
end

.upObject



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

def self.up
  create_table :line_items, :force => true do |t|
    t.integer :product_id
    t.integer :order_id
    t.integer :user_id
    t.string :size
    t.integer :price_cents, :default => 0
    t.string :price_currency
    t.integer :qty, :default => 0
    t.timestamps
  end
  add_index :line_items, :order_id
  add_index :line_items, :product_id
  add_index :line_items, :user_id
end