| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- # encoding:utf-8
- class CreateChannelQrcodes < ActiveRecord::Migration
- def self.up
- create_table :channel_qrcodes do |t|
- t.column :wx_gongzhonghao_id, :integer, :null => false
- #相关注册渠道
- t.column :parent_sign_up_channel_id, :integer
- t.column :scene_id, :integer, :default => 0
- #场景字符串
- t.column :scene_str, :string, :limit=>64
- # 是否永久
- t.boolean :is_permanent, :default => false
- # 描述
- t.column :remark, :text, :null => false
- # 二维码图片地址
- t.column :qrcode_img, :text #有效期
- t.column :expired_at, :datetime
- #被扫了多少次
- t.column :scan_times, :integer, :default => 0
- # 扫描后的推送
- t.column :push_after_sub_id, :integer, :default => 0
- #渠道外链-增加客服wx_id
- # t.column :cs_wx_uid, :integer, :default=>0
- #邀请人wx_id
- # t.column :invite_wx_uid, :integer, :default=>0
- t.timestamps
- end
- add_index :channel_qrcodes, :expired_at
- create_table :channel_qrcode_results do |t|
- t.column :mp_openid, :string, :default => 0
- t.column :channel_qrcode_id, :integer
- t.timestamps
- end
- add_index :channel_qrcode_results, :mp_openid
- add_index :channel_qrcode_results, :channel_qrcode_id
- add_index :channel_qrcode_results, [:mp_openid,:channel_qrcode_id], :unique => true, :name=>"idx_cq_result_openid_and_cq_id"
- end
- def self.down
- drop_table :channel_qrcodes
- drop_table :channel_qrcode_results
- end
- end
|