| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- <?php
- use think\migration\Migrator;
- use think\migration\db\Column;
- class ExtensionPayment extends Migrator
- {
- /**
- * 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(Column::integer('order_id')->setComment('关联订单ID'))
- ->addColumn(Column::char('order_sn', 20)->setComment('订单编号'))
- ->addColumn(Column::char('out_trade_no', 20)->setComment('商户支付订单号'))
- ->addColumn(Column::tinyInteger('biz_type')->setComment('业务类型:1-商品订单支付'))
- ->addColumn(Column::string('pay_type', 20)->setComment('支付方式:wechatpay-微信 xlpayment-信联支付'))
- ->addColumn(Column::json('payment_param')->setComment('支付参数'))
- ->addColumn(Column::decimal('amount', 10, 2)->setComment('支付金额(元)'))
- ->addColumn(Column::tinyInteger('status')->setComment('支付状态:0-待支付/1-支付中/2-成功/3-失败/4-已关闭/5-退款中'))
- ->addColumn(Column::char('transaction_id', 32)->setComment('三方支付订单号'))
- ->addColumn(Column::integer('payment_time')->setComment('支付成功时间'))
- ->addColumn(Column::integer('expire_time')->setComment('订单失效时间'))
- ->addColumn(Column::json('payment_result')->setComment('查询支付结果信息'))
- ->addColumn(Column::string('status_desc', 255)->setComment('支付状态说明'))
- ->addTimestamps()
- ->addIndex(['order_id', 'biz_type'])
- ->addIndex(['transaction_id'])
- ->addIndex(['out_trade_no'], ['unique' => true])
- ->create();
- }
- }
|