# encoding:utf-8
class CreateUserPerfomances < ActiveRecord::Migration
  def up
    #会员业绩汇总
    create_table :user_perfomances do |t|
      #开始时间
      t.column :begin_date,:datetime
      #结束时间
      t.column :end_date,:datetime
      #会员ID
      t.column :wx_user_id, :integer, :limit => 11, :default => 0
      #昵称
      t.column :nickname, :string,:limit => 256
      #普通订单业绩
      t.column :order_perfomance, :integer, :limit => 11, :default => 0
      # 店长专区订单业绩
      t.column :shop_order_perfomance, :integer, :limit => 11, :default => 0
      # 开店业绩
      t.column :shop_perfomance, :integer, :limit => 11, :default => 0
      # 充值业绩
      t.column :balance_perfomance, :integer, :limit => 11, :default => 0
      # 合计业绩
      t.column :total, :integer, :limit => 11, :default => 0
      t.timestamps
    end
    add_index :user_perfomances, :wx_user_id

  end

  def down
  	drop_table :user_perfomances
  end

end
