20161031910155_create_balance_orders.rb 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. # encoding:utf-8
  2. #
  3. # 我的余额充值记录表
  4. #
  5. class CreateBalanceOrders < ActiveRecord::Migration
  6. def up
  7. create_table :balance_orders do |t|
  8. #订单号
  9. t.column :order_id, :string, :limit => 64, :null => false
  10. #用户ID
  11. t.column :user_id, :integer, :null => false
  12. #微信用户ID
  13. t.column :wx_user_id, :integer
  14. #支付方式
  15. t.column :pay_way, :string, :limit => 20
  16. #交易号
  17. t.column :trade_no, :string, :limit => 64
  18. #支付时间
  19. t.column :paied_at, :integer
  20. #支付金额(单位:分)
  21. t.column :total_price, :integer, :limit => 8, :default => 0
  22. #实付金额(单位:分)
  23. t.column :paied_price, :integer, :limit => 8, :default => 0
  24. # 是否支付
  25. t.boolean :state, :default => false
  26. # 中文描述
  27. t.column :remark, :string
  28. #充值银行卡
  29. t.column :balance_bank_card_no, :string
  30. t.timestamps
  31. end
  32. add_index :balance_orders, :order_id
  33. add_index :balance_orders, :user_id
  34. add_index :balance_orders, :wx_user_id
  35. end
  36. def down
  37. drop_table :balance_orders
  38. end
  39. end