20250720063342_extension_payment.php 2.4 KB

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