# encoding: utf-8
# 我的提货券余额
class CreateBalances < ActiveRecord::Migration
  def self.up
    create_table :balances do |t|
      #用户id
      t.belongs_to :user
      t.integer :wx_user_id
      #有正负值
      t.integer :count  
      #来源
      t.string :source, :limit => 64
      #充值订单id，认购记录id等等，具体对应情况在model层配置
      t.string :relate_id
      #中文描述
      t.string :remark
      t.timestamps
    end    
    add_index :balances, :user_id
    add_index :balances, :wx_user_id
    add_index :balances, :relate_id
  end

  def self.down
    drop_table :balances
  end
end


