20201102114643_create_promotions.rb 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. # encoding:utf-8
  2. class CreatePromotions < ActiveRecord::Migration
  3. def up
  4. #促销表
  5. create_table :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 :is_first, :boolean, :default=>1
  14. # 多买多送
  15. t.column :is_more, :boolean, :default=>1
  16. # 订单类型
  17. t.column :order_type, :integer, :limit => 11, :default => 0
  18. # 最小金额
  19. t.column :min_total, :integer, :limit => 11, :default => 0
  20. # 最大金额
  21. t.column :max_total, :integer, :limit => 11, :default => 0
  22. # 买品1
  23. t.column :prod1, :integer, :limit => 11, :default => 0
  24. # 数量1
  25. t.column :nums1, :integer, :limit => 11, :default => 0
  26. # 买品2
  27. t.column :prod2, :integer, :limit => 11, :default => 0
  28. # 数量3
  29. t.column :nums2, :integer, :limit => 11, :default => 0
  30. # 买品3
  31. t.column :prod3, :integer, :limit => 11, :default => 0
  32. # 数量3
  33. t.column :nums3, :integer, :limit => 11, :default => 0
  34. # 赠品1
  35. t.column :send_prod1, :integer, :limit => 11, :default => 0
  36. # 数量1
  37. t.column :send_nums1, :integer, :limit => 11, :default => 0
  38. # 赠品2
  39. t.column :send_prod2, :integer, :limit => 11, :default => 0
  40. # 赠品数量2
  41. t.column :send_nums2, :integer, :limit => 11, :default => 0
  42. # 赠品3
  43. t.column :send_prod3, :integer, :limit => 11, :default => 0
  44. # 赠品数量3
  45. t.column :send_nums3, :integer, :limit => 11, :default => 0
  46. # 状态
  47. t.column :is_enable, :boolean, :default=>1
  48. # 赠代办金
  49. t.column :cash, :integer, :limit => 11, :default => 0
  50. # 赠积分
  51. t.column :cent, :integer, :limit => 11, :default => 0
  52. t.timestamps
  53. end
  54. add_index :shop_applications, :user_id
  55. add_index :shop_applications, :wx_user_id
  56. add_index :promotions, :begin_time
  57. add_index :promotions, :end_time
  58. end
  59. def down
  60. remove_index :shop_applications, :user_id
  61. remove_index :shop_applications, :wx_user_id
  62. drop_table :promotions
  63. end
  64. end