20210305114641_create_product_items.rb 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. # encoding:utf-8
  2. class CreateProductItems < ActiveRecord::Migration
  3. def up
  4. #套装明细
  5. create_table :product_items do |t|
  6. # 商品id
  7. t.column :product_id, :integer, :limit => 11, :default => 0
  8. # 商品名称
  9. t.column :title, :string, :limit => 255
  10. # 明细ID
  11. t.column :item_id, :integer, :limit => 11, :default => 0
  12. # 明细名称
  13. t.column :item_title, :string, :limit => 255
  14. # 数量
  15. t.column :nums, :integer, :limit => 11, :default => 0
  16. t.timestamps
  17. end
  18. #订单基本明细
  19. create_table :order_base_details do |t|
  20. # 商品id
  21. t.column :order_id, :integer, :limit => 11, :default => 0
  22. # 商品名称
  23. t.column :order_no, :string, :limit => 255
  24. # 明细ID
  25. t.column :order_dt_id, :integer, :limit => 11, :default => 0
  26. # 商品ID
  27. t.column :product_id, :integer, :limit => 11, :default => 0
  28. # 明细名称
  29. t.column :title, :string, :limit => 255
  30. # 数量
  31. t.column :nums, :integer, :limit => 11, :default => 0
  32. # 是否赠品
  33. t.column :send, :boolean, :default=>0
  34. t.timestamps
  35. end
  36. add_column :products, :package, :boolean, :default=>0
  37. end
  38. def down
  39. drop_table :product_items
  40. drop_table :order_base_details
  41. remove_column :products, :package
  42. end
  43. end