class CreateProductStocks < ActiveRecord::Migration
  def change
    create_table :product_stocks do |t|
      t.references :product, index: true
      t.integer :product_size_id
      t.integer :product_option_id
      t.integer :stock
      t.integer :stock_th

      t.timestamps null: false
    end
    add_foreign_key :product_stocks, :products
    
    Product.all.each do |product|
      product.save
    end
    
  end
end
