M240514111323AddPickupTable.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?php
  2. namespace addons\Store\console\migrations;
  3. use yii\db\Migration;
  4. /**
  5. * Class M240514111323AddPickupTable
  6. */
  7. class M240514111323AddPickupTable extends Migration
  8. {
  9. /**
  10. * {@inheritdoc}
  11. */
  12. public function safeUp()
  13. {
  14. $sql = <<<SQL
  15. CREATE TABLE `qimall_addons_store_order_pickup` (
  16. `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  17. `mall_id` int(10) NOT NULL,
  18. `store_id` int(10) NOT NULL COMMENT '门店ID',
  19. `order_id` int(10) NOT NULL COMMENT '门店订单ID',
  20. `mall_order_id` int(10) NOT NULL COMMENT '主商城订单ID',
  21. `stage` int(10) NOT NULL COMMENT '期数',
  22. `code` varchar(10) NOT NULL COMMENT '自提码',
  23. `updated_at` int(10) DEFAULT NULL,
  24. `created_at` int(10) DEFAULT NULL,
  25. PRIMARY KEY (`id`),
  26. KEY `store_id` (`store_id`),
  27. KEY `order_id` (`order_id`),
  28. KEY `stage` (`stage`),
  29. KEY `mall_order_id` (`mall_order_id`)
  30. ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='订单自提码';
  31. SQL;
  32. $this->execute($sql);
  33. }
  34. /**
  35. * {@inheritdoc}
  36. */
  37. public function safeDown()
  38. {
  39. echo "M240514111323AddPickupTable cannot be reverted.\n";
  40. return false;
  41. }
  42. }