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