M250114104035AddStoreLoseEffectOrderTable.php 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. <?php
  2. namespace addons\Store\console\migrations;
  3. use yii\db\Migration;
  4. /**
  5. * Class M250114104035AddStoreLoseEffectOrderTable
  6. */
  7. class M250114104035AddStoreLoseEffectOrderTable extends Migration
  8. {
  9. /**
  10. * {@inheritdoc}
  11. */
  12. public function safeUp()
  13. {
  14. $sql = <<<SQL
  15. CREATE TABLE `qimall_addons_store_lose_order` (
  16. `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  17. `mall_id` int(11) NOT NULL DEFAULT '0',
  18. `user_id` int(11) NOT NULL DEFAULT '0' COMMENT '流失的门店user_id',
  19. `order_id` int(11) NOT NULL DEFAULT '0' COMMENT '订单id,store_order表id',
  20. `status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '状态:-1删除,0禁用,1正常',
  21. `created_at` int(11) NOT NULL DEFAULT '0',
  22. `updated_at` int(11) NOT NULL DEFAULT '0',
  23. PRIMARY KEY (`id`),
  24. KEY `idx_muo` (`mall_id`,`user_id`,`order_id`) USING BTREE
  25. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='门店入驻限制-流失订单';
  26. CREATE TABLE `qimall_addons_store_effect_order` (
  27. `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  28. `mall_id` int(11) NOT NULL DEFAULT '0',
  29. `store_id` int(11) NOT NULL DEFAULT '0' COMMENT '门店id',
  30. `user_id` int(11) NOT NULL DEFAULT '0' COMMENT '订单id,store_order表的user_id',
  31. `store_user_id` int(11) NOT NULL DEFAULT '0' COMMENT '门店用户id',
  32. `order_id` int(11) NOT NULL DEFAULT '0' COMMENT '订单id,store_order表的id',
  33. `status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '状态,-1删除,0禁用,1正常',
  34. `created_at` int(11) NOT NULL DEFAULT '0',
  35. `updated_at` int(11) NOT NULL DEFAULT '0',
  36. PRIMARY KEY (`id`),
  37. KEY `idx_mus` (`mall_id`,`user_id`,`store_user_id`) USING BTREE
  38. ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COMMENT='门店入驻限制-门店有效订单';
  39. SQL;
  40. $this->execute($sql);
  41. }
  42. /**
  43. * {@inheritdoc}
  44. */
  45. public function safeDown()
  46. {
  47. echo "M250114104035AddStoreLoseEffectOrderTable cannot be reverted.\n";
  48. return false;
  49. }
  50. /*
  51. // Use up()/down() to run migration code without a transaction.
  52. public function up()
  53. {
  54. }
  55. public function down()
  56. {
  57. echo "M250114104035AddStoreLoseEffectOrderTable cannot be reverted.\n";
  58. return false;
  59. }
  60. */
  61. }