20210325114688_create_recharge_promotions.rb 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. # encoding:utf-8
  2. class CreateRechargePromotions < ActiveRecord::Migration
  3. def up
  4. #店长促销表
  5. create_table :shop_promotions do |t|
  6. # 促销名称
  7. t.column :name, :string,:limit => 128
  8. #开始时间
  9. t.column :begin_time,:datetime
  10. #结束时间
  11. t.column :end_time,:datetime
  12. # 部门
  13. t.column :depart, :integer, :limit => 11, :null => false, :default => 0
  14. # 充值金额
  15. t.column :total, :integer, :limit => 11, :default => 0
  16. # 赠提货券
  17. t.column :cash, :integer, :limit => 11, :default => 0
  18. # 赠积分
  19. t.column :cent, :integer, :limit => 11, :default => 0
  20. # 赠品1
  21. t.column :send_prod1, :integer, :limit => 11, :default => 0
  22. # 数量1
  23. t.column :send_nums1, :integer, :limit => 11, :default => 0
  24. # 赠品2
  25. t.column :send_prod2, :integer, :limit => 11, :default => 0
  26. # 赠品数量2
  27. t.column :send_nums2, :integer, :limit => 11, :default => 0
  28. # 赠品3
  29. t.column :send_prod3, :integer, :limit => 11, :default => 0
  30. # 赠品数量3
  31. t.column :send_nums3, :integer, :limit => 11, :default => 0
  32. # 赠品4
  33. t.column :send_prod4, :integer, :limit => 11, :default => 0
  34. # 赠品数量4
  35. t.column :send_nums4, :integer, :limit => 11, :default => 0
  36. # 赠品5
  37. t.column :send_prod5, :integer, :limit => 11, :default => 0
  38. # 赠品数量5
  39. t.column :send_nums5, :integer, :limit => 11, :default => 0
  40. # 状态
  41. t.column :is_enable, :boolean, :default=>1
  42. t.timestamps
  43. end
  44. add_index :shop_promotions, :begin_time
  45. add_index :shop_promotions, :end_time
  46. add_index :shop_promotions, :total
  47. #商城赠品
  48. create_table :presents do |t|
  49. # 微信ID
  50. t.column :wx_user_id, :integer, :limit => 11, :default => 0
  51. # 单价
  52. t.column :price, :integer, :limit => 11, :default => 0
  53. # 总价
  54. t.column :total, :integer, :limit => 11, :default => 0
  55. # 赠品1
  56. t.column :send_prod1, :integer, :limit => 11, :default => 0
  57. # 数量1
  58. t.column :send_nums1, :integer, :limit => 11, :default => 0
  59. # 状态
  60. t.column :status, :boolean, :default=>1
  61. # 订单号
  62. t.column :order_id, :string, :limit => 64
  63. #来源
  64. t.column :source, :string, :limit => 255
  65. #备注
  66. t.column :remark, :string, :limit => 255
  67. t.timestamps
  68. end
  69. add_index :presents, :wx_user_id
  70. add_index :presents, :order_id
  71. add_column :balance_promotions, :max_total, :integer, :default=>0,:limit => 11
  72. add_column :balance_promotions, :depart, :integer, :null => false, :default=>0,:limit => 11
  73. add_column :balance_promotions, :is_more, :boolean, :default=>0,:limit => 4
  74. add_column :promotions, :depart, :integer, :null => false, :default=>0,:limit => 11
  75. end
  76. def down
  77. drop_table :shop_promotions
  78. drop_table :presents
  79. end
  80. end