class CreateWxUserGongzhonghao < ActiveRecord::Migration def change create_table :wx_user_gongzhonghaos do |t| #微信用户ID t.integer :wx_user_id, :null => false #appid t.string :app_id, :null => false #openid t.string :gzh_open_id, :limit => 64 t.boolean :subscribe t.integer :subscribe_time t.integer :unsubscribe_time t.integer :last_conversation_at t.timestamps end add_index :wx_user_gongzhonghaos, :app_id add_index :wx_user_gongzhonghaos, :gzh_open_id add_index :wx_user_gongzhonghaos, :wx_user_id end def self.down remove_index :wx_user_gongzhonghaos, :app_id remove_index :wx_user_gongzhonghaos, :gzh_open_id remove_index :wx_user_gongzhonghaos, :wx_user_id drop_table :wx_user_gongzhonghaos end end