M230112012901CreateTableQijuheOrderRefund.php 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <?php
  2. namespace addons\QiJuhe\console\migrations;
  3. use yii\db\Migration;
  4. /**
  5. * Class M230112012901CreateTableQijuheOrderRefund
  6. */
  7. class M230112012901CreateTableQijuheOrderRefund extends Migration
  8. {
  9. /**
  10. * {@inheritdoc}
  11. */
  12. public function safeUp()
  13. {
  14. $table = 'qimall_addons_qijuhe_order_refund';
  15. $check_table_sql="select * from information_schema.TABLES where TABLE_NAME = '{$table}';";
  16. $res = $this->db->createCommand($check_table_sql)->execute();
  17. if(!empty($res)) return '';
  18. $sql = "CREATE TABLE `qimall_addons_qijuhe_order_refund` (
  19. `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  20. `mall_id` int(10) unsigned DEFAULT '0',
  21. `supply_id` int(10) DEFAULT NULL COMMENT '中台ID',
  22. `order_id` int(10) unsigned DEFAULT '0' COMMENT '订单ID',
  23. `num` int(10) unsigned DEFAULT '0' COMMENT '售后数量',
  24. `order_no` varchar(64) DEFAULT '' COMMENT '商城订单编号',
  25. `order_refund_id` int(10) unsigned DEFAULT '0' COMMENT '商城售后订单ID',
  26. `after_sales_id` int(10) DEFAULT NULL COMMENT '中台售后ID',
  27. `data` text COMMENT '售后数据',
  28. `status` tinyint(4) unsigned DEFAULT '0' COMMENT '是否推送售后',
  29. `refund_status` tinyint(4) unsigned DEFAULT '0',
  30. `shipping_address_id` int(10) unsigned DEFAULT '0' COMMENT '中台退货地址ID',
  31. `error_msg` varchar(255) DEFAULT '' COMMENT '错误信息',
  32. `return_data` text,
  33. `created_at` int(10) unsigned DEFAULT '0',
  34. `updated_at` int(10) unsigned DEFAULT '0',
  35. PRIMARY KEY (`id`),
  36. KEY `mall_id` (`mall_id`),
  37. KEY `order_id` (`order_id`)
  38. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='七件事供应链售后表';";
  39. $this->execute($sql);
  40. }
  41. /**
  42. * {@inheritdoc}
  43. */
  44. public function safeDown()
  45. {
  46. echo "M230112012901CreateTableQijuheOrderRefund cannot be reverted.\n";
  47. return false;
  48. }
  49. }