M240712141230AddTableUserTeamAchievementTable.php 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. <?php
  2. namespace app\migrations;
  3. use yii\db\Migration;
  4. /**
  5. * Class M240712141230AddTableUserTeamAchievementTable
  6. */
  7. class M240712141230AddTableUserTeamAchievementTable extends Migration
  8. {
  9. /**
  10. * {@inheritdoc}
  11. */
  12. public function safeUp()
  13. {
  14. try {
  15. $sql = <<<SQL
  16. CREATE TABLE `qimall_user_team_achievement_order_1` (
  17. `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
  18. `mall_id` int(10) NOT NULL,
  19. `user_id` int(10) NOT NULL COMMENT '下单会员ID',
  20. `order_id` int(10) NOT NULL COMMENT '订单ID',
  21. `superior_user_id` int(10) NOT NULL COMMENT '团队上级会员ID',
  22. `superior_level` int(10) NOT NULL COMMENT '上级级别',
  23. `status` tinyint(1) NOT NULL COMMENT '1 已支付 2 已完成',
  24. `created_at` int(10) NULL,
  25. PRIMARY KEY (`id`),
  26. INDEX `idx_mall_id`(`mall_id`),
  27. INDEX `idx_superior_user_id`(`superior_user_id`),
  28. INDEX `idx_order_id`(`order_id`)
  29. ) ENGINE = InnoDB COMMENT = '团队业绩订单表';
  30. CREATE TABLE `qimall_user_team_achievement_order_2` (
  31. `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
  32. `mall_id` int(10) NOT NULL,
  33. `user_id` int(10) NOT NULL COMMENT '下单会员ID',
  34. `order_id` int(10) NOT NULL COMMENT '订单ID',
  35. `superior_user_id` int(10) NOT NULL COMMENT '团队上级会员ID',
  36. `superior_level` int(10) NOT NULL COMMENT '上级级别',
  37. `status` tinyint(1) NOT NULL COMMENT '1 已支付 2 已完成',
  38. `created_at` int(10) NULL,
  39. PRIMARY KEY (`id`),
  40. INDEX `idx_mall_id`(`mall_id`),
  41. INDEX `idx_superior_user_id`(`superior_user_id`),
  42. INDEX `idx_order_id`(`order_id`)
  43. ) ENGINE = InnoDB COMMENT = '团队业绩订单表';
  44. CREATE TABLE `qimall_user_team_achievement_order_3` (
  45. `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
  46. `mall_id` int(10) NOT NULL,
  47. `user_id` int(10) NOT NULL COMMENT '下单会员ID',
  48. `order_id` int(10) NOT NULL COMMENT '订单ID',
  49. `superior_user_id` int(10) NOT NULL COMMENT '团队上级会员ID',
  50. `superior_level` int(10) NOT NULL COMMENT '上级级别',
  51. `status` tinyint(1) NOT NULL COMMENT '1 已支付 2 已完成',
  52. `created_at` int(10) NULL,
  53. PRIMARY KEY (`id`),
  54. INDEX `idx_mall_id`(`mall_id`),
  55. INDEX `idx_superior_user_id`(`superior_user_id`),
  56. INDEX `idx_order_id`(`order_id`)
  57. ) ENGINE = InnoDB COMMENT = '团队业绩订单表';
  58. CREATE TABLE `qimall_user_team_achievement_order_4` (
  59. `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
  60. `mall_id` int(10) NOT NULL,
  61. `user_id` int(10) NOT NULL COMMENT '下单会员ID',
  62. `order_id` int(10) NOT NULL COMMENT '订单ID',
  63. `superior_user_id` int(10) NOT NULL COMMENT '团队上级会员ID',
  64. `superior_level` int(10) NOT NULL COMMENT '上级级别',
  65. `status` tinyint(1) NOT NULL COMMENT '1 已支付 2 已完成',
  66. `created_at` int(10) NULL,
  67. PRIMARY KEY (`id`),
  68. INDEX `idx_mall_id`(`mall_id`),
  69. INDEX `idx_superior_user_id`(`superior_user_id`),
  70. INDEX `idx_order_id`(`order_id`)
  71. ) ENGINE = InnoDB COMMENT = '团队业绩订单表';
  72. CREATE TABLE `qimall_user_team_achievement_order_5` (
  73. `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
  74. `mall_id` int(10) NOT NULL,
  75. `user_id` int(10) NOT NULL COMMENT '下单会员ID',
  76. `order_id` int(10) NOT NULL COMMENT '订单ID',
  77. `superior_user_id` int(10) NOT NULL COMMENT '团队上级会员ID',
  78. `superior_level` int(10) NOT NULL COMMENT '上级级别',
  79. `status` tinyint(1) NOT NULL COMMENT '1 已支付 2 已完成',
  80. `created_at` int(10) NULL,
  81. PRIMARY KEY (`id`),
  82. INDEX `idx_mall_id`(`mall_id`),
  83. INDEX `idx_superior_user_id`(`superior_user_id`),
  84. INDEX `idx_order_id`(`order_id`)
  85. ) ENGINE = InnoDB COMMENT = '团队业绩订单表';
  86. CREATE TABLE `qimall_user_team_achievement_order_6` (
  87. `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
  88. `mall_id` int(10) NOT NULL,
  89. `user_id` int(10) NOT NULL COMMENT '下单会员ID',
  90. `order_id` int(10) NOT NULL COMMENT '订单ID',
  91. `superior_user_id` int(10) NOT NULL COMMENT '团队上级会员ID',
  92. `superior_level` int(10) NOT NULL COMMENT '上级级别',
  93. `status` tinyint(1) NOT NULL COMMENT '1 已支付 2 已完成',
  94. `created_at` int(10) NULL,
  95. PRIMARY KEY (`id`),
  96. INDEX `idx_mall_id`(`mall_id`),
  97. INDEX `idx_superior_user_id`(`superior_user_id`),
  98. INDEX `idx_order_id`(`order_id`)
  99. ) ENGINE = InnoDB COMMENT = '团队业绩订单表';
  100. CREATE TABLE `qimall_user_team_achievement_order_7` (
  101. `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
  102. `mall_id` int(10) NOT NULL,
  103. `user_id` int(10) NOT NULL COMMENT '下单会员ID',
  104. `order_id` int(10) NOT NULL COMMENT '订单ID',
  105. `superior_user_id` int(10) NOT NULL COMMENT '团队上级会员ID',
  106. `superior_level` int(10) NOT NULL COMMENT '上级级别',
  107. `status` tinyint(1) NOT NULL COMMENT '1 已支付 2 已完成',
  108. `created_at` int(10) NULL,
  109. PRIMARY KEY (`id`),
  110. INDEX `idx_mall_id`(`mall_id`),
  111. INDEX `idx_superior_user_id`(`superior_user_id`),
  112. INDEX `idx_order_id`(`order_id`)
  113. ) ENGINE = InnoDB COMMENT = '团队业绩订单表';
  114. CREATE TABLE `qimall_user_team_achievement_order_8` (
  115. `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
  116. `mall_id` int(10) NOT NULL,
  117. `user_id` int(10) NOT NULL COMMENT '下单会员ID',
  118. `order_id` int(10) NOT NULL COMMENT '订单ID',
  119. `superior_user_id` int(10) NOT NULL COMMENT '团队上级会员ID',
  120. `superior_level` int(10) NOT NULL COMMENT '上级级别',
  121. `status` tinyint(1) NOT NULL COMMENT '1 已支付 2 已完成',
  122. `created_at` int(10) NULL,
  123. PRIMARY KEY (`id`),
  124. INDEX `idx_mall_id`(`mall_id`),
  125. INDEX `idx_superior_user_id`(`superior_user_id`),
  126. INDEX `idx_order_id`(`order_id`)
  127. ) ENGINE = InnoDB COMMENT = '团队业绩订单表';
  128. CREATE TABLE `qimall_user_team_achievement_order_9` (
  129. `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
  130. `mall_id` int(10) NOT NULL,
  131. `user_id` int(10) NOT NULL COMMENT '下单会员ID',
  132. `order_id` int(10) NOT NULL COMMENT '订单ID',
  133. `superior_user_id` int(10) NOT NULL COMMENT '团队上级会员ID',
  134. `superior_level` int(10) NOT NULL COMMENT '上级级别',
  135. `status` tinyint(1) NOT NULL COMMENT '1 已支付 2 已完成',
  136. `created_at` int(10) NULL,
  137. PRIMARY KEY (`id`),
  138. INDEX `idx_mall_id`(`mall_id`),
  139. INDEX `idx_superior_user_id`(`superior_user_id`),
  140. INDEX `idx_order_id`(`order_id`)
  141. ) ENGINE = InnoDB COMMENT = '团队业绩订单表';
  142. CREATE TABLE `qimall_user_team_achievement_order_10` (
  143. `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
  144. `mall_id` int(10) NOT NULL,
  145. `user_id` int(10) NOT NULL COMMENT '下单会员ID',
  146. `order_id` int(10) NOT NULL COMMENT '订单ID',
  147. `superior_user_id` int(10) NOT NULL COMMENT '团队上级会员ID',
  148. `superior_level` int(10) NOT NULL COMMENT '上级级别',
  149. `status` tinyint(1) NOT NULL COMMENT '1 已支付 2 已完成',
  150. `created_at` int(10) NULL,
  151. PRIMARY KEY (`id`),
  152. INDEX `idx_mall_id`(`mall_id`),
  153. INDEX `idx_superior_user_id`(`superior_user_id`),
  154. INDEX `idx_order_id`(`order_id`)
  155. ) ENGINE = InnoDB COMMENT = '团队业绩订单表';
  156. SQL;
  157. $this->execute($sql);
  158. } catch (\Exception $e) {
  159. }
  160. }
  161. /**
  162. * {@inheritdoc}
  163. */
  164. public function safeDown()
  165. {
  166. echo "M240712141230AddTableUserTeamAchievementTable cannot be reverted.\n";
  167. return false;
  168. }
  169. }