# encoding:utf-8 class CreateProductItems < ActiveRecord::Migration def up #套装明细 create_table :product_items do |t| # 商品id t.column :product_id, :integer, :limit => 11, :default => 0 # 商品名称 t.column :title, :string, :limit => 255 # 明细ID t.column :item_id, :integer, :limit => 11, :default => 0 # 明细名称 t.column :item_title, :string, :limit => 255 # 数量 t.column :nums, :integer, :limit => 11, :default => 0 t.timestamps end #订单基本明细 create_table :order_base_details do |t| # 商品id t.column :order_id, :integer, :limit => 11, :default => 0 # 商品名称 t.column :order_no, :string, :limit => 255 # 明细ID t.column :order_dt_id, :integer, :limit => 11, :default => 0 # 商品ID t.column :product_id, :integer, :limit => 11, :default => 0 # 明细名称 t.column :title, :string, :limit => 255 # 数量 t.column :nums, :integer, :limit => 11, :default => 0 # 是否赠品 t.column :send, :boolean, :default=>0 t.timestamps end add_column :products, :package, :boolean, :default=>0 end def down drop_table :product_items drop_table :order_base_details remove_column :products, :package end end