# encoding:utf-8
class CreateOrderRefunds < ActiveRecord::Migration
  def up
    #订单退款记录
    create_table :order_refunds do |t|
      # 订单Id
      t.column :order_id, :string,:limit => 128
      # 微信ID
      t.column :wx_user_id, :integer, :limit => 11, :default => 0
      # 微信支付单号
      t.column :transaction_id, :string,:limit => 256
      # 订单金额
      t.column :total, :integer, :limit => 11, :default => 0
      # 微信退款金额
      t.column :refund_fee, :integer, :limit => 11, :default => 0
      # 到账时间
      t.column :refund_time, :integer, :limit => 11, :default => 0
      # 到账状态
      t.column :status, :boolean, :default=>0
      # 备注
      t.column :remark, :string,:limit => 128
      t.timestamps
    end
    add_index :order_refunds, :order_id
    add_column :orders, :cent_price,:integer,:limit => 11

  end

  def down
    drop_table :order_refunds
    remove_column :orders, :cent_price
  end

end
