# encoding:utf-8
class CreateAgentApplys < ActiveRecord::Migration
  def up

    create_table :agent_applys do |t|
      # 申请时间
      t.column :happen_time, :integer, :limit => 11, :default => 0
      # 申请人ID
      t.column :intro_user_id, :integer, :limit => 11, :default => 0
      #微信会员id
      t.column :wx_user_id, :integer, :limit => 11, :default => 0
      # 昵称
      t.column :nickname, :string, :limit => 255
      # 手机号码
      t.column :mobile, :string, :limit => 128
      # 部门ID
      t.column :depart, :integer, :limit => 11, :default => 0
      # 审核人ID
      t.column :com_user_id, :integer, :limit => 11, :default => 0
      # 审核时间
      t.column :com_time, :integer, :limit => 11, :default => 0
      # 是否审核
      t.column :status, :boolean, :default=>0
      t.timestamps
    end

    add_index :agent_applys,:intro_user_id,:name => "idx_intro_user_id"
    add_index :agent_applys,:wx_user_id,:name => "idx_wx_user_id"

  end

  def down
    drop_table :agent_applys
  end

end
