# encoding:utf-8
class CreateCentBalances < ActiveRecord::Migration
  def up
    #积分账户
    create_table :cent_balances do |t|
      #用户ID
      t.column :wx_uid, :integer, :null=>false
      #变动金额(分)
      t.column :count, :integer, :null=>false
      #来源
      t.column :source, :string, :limit=>64
      #关联ID
      t.column :relate_id, :string
      #备注
      t.column :remark,:string
      t.timestamps
    end
    #积分活动配置
    create_table :cent_awards do |t|
      #变动金额(分)
      t.column :count, :integer, :null=>false
      #活动类型
      t.column :c_type, :string, :limit=>64
      #备注
      t.column :remark,:string
      t.timestamps
    end
    add_index :cent_balances, :wx_uid
    add_index :cent_awards, :c_type

  end

  def down
    drop_table :cent_balances
    drop_table :cent_awards
  end

end
