20201001114641_create_order_statics.rb 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. # encoding:utf-8
  2. class CreateOrderStatics < ActiveRecord::Migration
  3. def up
  4. #创建商品销售汇总
  5. create_table :order_statics do |t|
  6. #开始时间
  7. t.column :begin_date,:datetime
  8. #结束时间
  9. t.column :end_date,:datetime
  10. #订单状态
  11. t.column :state, :string,:limit => 256
  12. # 是否赠品
  13. t.column :is_send, :boolean, :default=>1
  14. t.timestamps
  15. end
  16. #创建商品销售汇总明细
  17. create_table :order_static_details do |t|
  18. #开始时间
  19. t.column :begin_date,:datetime
  20. #结束时间
  21. t.column :end_date,:datetime
  22. #订单状态
  23. t.column :state, :string,:limit => 256
  24. # 是否赠品
  25. t.column :is_send, :boolean, :default=>1
  26. # 产品ID
  27. t.column :product_id, :integer, :limit => 8, :default => 0
  28. # 商品名称
  29. t.column :product_name, :string,:limit => 256
  30. # 数量
  31. t.column :nums, :integer, :limit => 8, :default => 0
  32. # 总金额
  33. t.column :total, :integer, :limit => 11, :default => 0
  34. t.timestamps
  35. end
  36. end
  37. def down
  38. drop_table :order_statics
  39. drop_table :order_static_details
  40. end
  41. end