tap/db/migrate/20141123151756_create_orders.rb
2014-11-23 21:12:31 +01:00

13 lines
272 B
Ruby

class CreateOrders < ActiveRecord::Migration
def change
create_table :orders do |t|
t.references :user, index: true
t.string :products
t.integer :cost
t.timestamps null: false
end
add_index :orders, [:user_id, :created_at]
end
end