20210305114641_create_product_items.rb 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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. t.timestamps
  33. end
  34. add_column :products, :package, :boolean, :default=>0
  35. end
  36. def down
  37. drop_table :product_items
  38. drop_table :order_base_details
  39. remove_column :products, :package
  40. end
  41. end