20181025094915_create_xcx_push_tmpl_tables.rb 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. class CreateXcxPushTmplTables < ActiveRecord::Migration
  2. def self.up
  3. create_table :xcx_push_tmpls do |t|
  4. # 这里单独可填微信用户id(以逗号分隔)、填all(所有微信用户)、填allUser(所有注册用户)、填sql=xxx(xxx执行结果是WxUser结构体)
  5. t.column :user_id, :text
  6. #模板类型 决定使用哪个模板id
  7. t.column :msg_type, :string
  8. #强制推送
  9. t.column :push_force, :boolean, :default=>false
  10. #模板需要放大的关键词,不填则默认无放大,填写keyword1.DATA、keyword2.DATA..
  11. t.column :emphasis_keyword, :string
  12. #内容1
  13. t.column :keyword1, :string
  14. t.column :keyword2, :string
  15. t.column :keyword3, :string
  16. t.column :keyword4, :string
  17. #内容5
  18. t.column :keyword5, :string
  19. #模板进入链接
  20. t.column :page, :string
  21. #推送次数
  22. t.column :times, :integer, :default => 0
  23. # 最后一次发送时间
  24. t.column :last_updated_at, :datetime
  25. t.timestamps
  26. end
  27. create_table :xcx_push_tmpl_records do |t|
  28. t.column :wx_uid, :integer, :null=>false
  29. t.column :push_time, :datetime, :null=>false
  30. t.column :temp_id, :integer, :null=>false
  31. end
  32. add_index :xcx_push_tmpl_records, :wx_uid
  33. end
  34. def self.down
  35. drop_table :xcx_push_tmpls
  36. drop_table :xcx_push_tmpl_records
  37. end
  38. end