#微信公众号
class CreateWxGongzhonghaos < ActiveRecord::Migration
  def self.up
    create_table :wx_gongzhonghaos  do |t|
      #公众号id
      t.string   :wx_hao, :null => false
      #公众号名称
      t.string   :wx_name, :null => false
      #类型
      t.column   :wx_type,  "ENUM('service','subscribe') NOT NULL DEFAULT 'service'"
      #认证
      t.boolean  :is_authed, :default => false
      t.string   :app_id, :null => false
      t.string   :app_secret
      t.string   :token
      # 关注时回复
      t.text   :sub_return_text
      t.timestamps
    end

    add_index :wx_gongzhonghaos, :wx_hao, :unique => true
    add_index :wx_gongzhonghaos, :app_id, :unique => true
  end

  def self.down
    drop_table :wx_gongzhonghaos
  end

end
