20250720063342_extension_payment.php 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <?php
  2. use Phinx\Migration\AbstractMigration;
  3. class ExtensionPayment extends AbstractMigration
  4. {
  5. /**
  6. * Change Method.
  7. *
  8. * Write your reversible migrations using this method.
  9. *
  10. * More information on writing migrations is available here:
  11. * http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
  12. *
  13. * The following commands can be used in this method and Phinx will
  14. * automatically reverse them when rolling back:
  15. *
  16. * createTable
  17. * renameTable
  18. * addColumn
  19. * renameColumn
  20. * addIndex
  21. * addForeignKey
  22. *
  23. * Remember to call "create()" or "update()" and NOT "save()" when working
  24. * with the Table class.
  25. */
  26. public function change(): void
  27. {
  28. $this->table('extension_payment')
  29. ->setComment('订单支付记录表')
  30. ->addColumn('order_id', 'integer', ['comment' => '关联订单ID'])
  31. ->addColumn('order_sn', 'char', ['limit' => 20, 'comment' => '订单编号'])
  32. ->addColumn('out_trade_no', 'char', ['limit' => 20, 'comment' => '商户支付订单号'])
  33. ->addColumn('biz_type', 'integer', ['signed' => false, 'length' => 3, 'comment' => '业务类型:1-商品订单支付'])
  34. ->addColumn('pay_type', 'string', ['limit' => 20, 'comment' => '支付方式:wechatpay-微信 xlpayment-信联支付'])
  35. ->addColumn('payment_param', 'json', ['comment' => '支付参数'])
  36. ->addColumn('amount', 'decimal', ['precision' => 10, 'scale' => 2, 'comment' => '支付金额(元)'])
  37. ->addColumn('status', 'integer', ['signed' => false, 'length' => 3, 'comment' => '支付状态:0-待支付/1-支付中/2-成功/3-失败/4-已关闭/5-退款中'])
  38. ->addColumn('transaction_id', 'char', ['limit' => 32, 'comment' => '三方支付订单号'])
  39. ->addColumn('payment_time', 'integer', ['comment' => '支付成功时间'])
  40. ->addColumn('expire_time', 'integer', ['comment' => '订单失效时间'])
  41. ->addColumn('payment_result', 'json', ['comment' => '查询支付结果信息'])
  42. ->addColumn('status_desc', 'string', ['limit' => 255, 'comment' => '支付状态说明'])
  43. ->addTimestamps()
  44. ->addIndex(['order_id', 'biz_type'])
  45. ->addIndex(['transaction_id'])
  46. ->addIndex(['out_trade_no'], ['unique' => true])
  47. ->create();
  48. }
  49. }