M241108110302CreatePaymentTypeRefundStatisticsDetailsTable.php 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. namespace app\migrations;
  3. use yii\db\Migration;
  4. /**
  5. * Handles the creation of table `{{%payment_type_refund_statistics_details}}`.
  6. */
  7. class M241108110302CreatePaymentTypeRefundStatisticsDetailsTable extends Migration
  8. {
  9. /**
  10. * {@inheritdoc}
  11. */
  12. public function safeUp()
  13. {
  14. $sql = <<<SQL
  15. CREATE TABLE `qimall_payment_type_refund_statistics_details` (
  16. `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  17. `mall_id` int(10) unsigned NOT NULL DEFAULT '0',
  18. `status` tinyint(4) NOT NULL DEFAULT '1' COMMENT '状态[-1:删除;0:禁用;1启用]',
  19. `payment_type` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '支付方式',
  20. `statistics_id` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '关联qimall_payment_type_refund_statistics表',
  21. `trade_type` varchar(100) NOT NULL DEFAULT '' COMMENT '聚合支付具体的支付方式',
  22. `total_refund_money` decimal(12,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '成功退款的退款金额',
  23. `total_pay_money` decimal(12,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '成功退款的订单的实付金额',
  24. `date` int(10) unsigned NOT NULL DEFAULT '0',
  25. `created_at` int(10) unsigned NOT NULL DEFAULT '0',
  26. `updated_at` int(10) unsigned NOT NULL DEFAULT '0',
  27. PRIMARY KEY (`id`),
  28. KEY `statistics_id+payment_type+trade_type` (`statistics_id`,`payment_type`,`trade_type`) USING BTREE,
  29. KEY `statistics_id+date` (`statistics_id`,`date`)
  30. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='统计每种支付方式的退款明细数据(拆表是为了兼容组合支付)';
  31. SQL;
  32. $this->execute($sql);
  33. }
  34. /**
  35. * {@inheritdoc}
  36. */
  37. public function safeDown()
  38. {
  39. return false;
  40. }
  41. }