| 12345678910111213141516171819202122232425262728293031323334353637383940 |
- # encoding:utf-8
- class CreateCarts < ActiveRecord::Migration
- def up
- #购物车表
- create_table :carts do |t|
- # 会员ID
- t.column :user_id, :integer, :limit => 8, :default => 0
- # 微信ID
- t.column :wx_user_id, :integer, :limit => 8, :default => 0
- # 产品ID
- t.column :product_id, :integer, :limit => 8, :default => 0
- # 数量
- t.column :nums, :integer, :limit => 8, :default => 0
- # 是否购买
- t.column :is_buy, :boolean, :default=>1
- t.timestamps
- end
- #订单明细表
- create_table :order_details do |t|
- # 订单ID
- t.column :order_id, :integer, :limit => 8, :default => 0
- # 产品ID
- t.column :product_id, :integer, :limit => 8, :default => 0
- # 数量
- t.column :nums, :integer, :limit => 8, :default => 0
- # 价格
- t.column :price, :integer, :limit => 8, :default => 0
- # 产品名称
- t.column :product_name, :string,:limit => 500
- t.timestamps
- end
- end
- def down
- drop_table :carts
- end
- end
|