class CreateXcxPushTmplTables < ActiveRecord::Migration def self.up create_table :xcx_push_tmpls do |t| # 这里单独可填微信用户id(以逗号分隔)、填all(所有微信用户)、填allUser(所有注册用户)、填sql=xxx(xxx执行结果是WxUser结构体) t.column :user_id, :text #模板类型 决定使用哪个模板id t.column :msg_type, :string #强制推送 t.column :push_force, :boolean, :default=>false #模板需要放大的关键词,不填则默认无放大,填写keyword1.DATA、keyword2.DATA.. t.column :emphasis_keyword, :string #内容1 t.column :keyword1, :string t.column :keyword2, :string t.column :keyword3, :string t.column :keyword4, :string #内容5 t.column :keyword5, :string #模板进入链接 t.column :page, :string #推送次数 t.column :times, :integer, :default => 0 # 最后一次发送时间 t.column :last_updated_at, :datetime t.timestamps end create_table :xcx_push_tmpl_records do |t| t.column :wx_uid, :integer, :null=>false t.column :push_time, :datetime, :null=>false t.column :temp_id, :integer, :null=>false end add_index :xcx_push_tmpl_records, :wx_uid end def self.down drop_table :xcx_push_tmpls drop_table :xcx_push_tmpl_records end end