M230602151236QimallAddonsDoubleCopyChangePos.php 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. <?php
  2. namespace addons\DoubleCopy\console\migrations;
  3. use yii\db\Migration;
  4. /**
  5. * Class M230602151236QimallAddonsDoubleCopyChangePos
  6. */
  7. class M230602151236QimallAddonsDoubleCopyChangePos extends Migration
  8. {
  9. /**
  10. * {@inheritdoc}
  11. */
  12. public function safeUp()
  13. {
  14. $sql = "CREATE TABLE `qimall_addons_double_copy_change_pos` (
  15. `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  16. `mall_id` int(10) NOT NULL DEFAULT '0' COMMENT '商城ID',
  17. `content` text COLLATE utf8mb4_unicode_ci COMMENT '交换内容',
  18. `change_status` tinyint(2) DEFAULT '0' COMMENT '交换状态[-1=交换失败,0=交换中,1=交换成功]',
  19. `reason` text COLLATE utf8mb4_unicode_ci COMMENT '失败原因',
  20. `status` tinyint(4) NOT NULL DEFAULT '1' COMMENT '状态[-1:删除;0:禁用;1启用]',
  21. `created_at` int(10) DEFAULT '0' COMMENT '创建时间',
  22. `updated_at` int(10) DEFAULT '0' COMMENT '更新时间',
  23. PRIMARY KEY (`id`) USING BTREE,
  24. KEY `mall_id` (`mall_id`) USING BTREE
  25. ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC COMMENT='位置交换表';";
  26. $sql.= "CREATE TABLE `qimall_addons_double_copy_change_topid` (
  27. `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  28. `change_pos_id` int(10) NOT NULL DEFAULT '0' COMMENT 'qimall_addons_double_copy_change_pos.id',
  29. `mall_id` int(10) NOT NULL DEFAULT '0' COMMENT '商城ID',
  30. `user_id` int(10) DEFAULT '0' COMMENT '用户ID',
  31. `old_topid` int(10) DEFAULT '0' COMMENT '原topid',
  32. `now_topid` int(10) DEFAULT '0' COMMENT '现topid',
  33. `status` tinyint(4) NOT NULL DEFAULT '1' COMMENT '状态[-1:删除;0:禁用;1启用]',
  34. `created_at` int(10) DEFAULT '0' COMMENT '创建时间',
  35. `updated_at` int(10) DEFAULT '0' COMMENT '更新时间',
  36. PRIMARY KEY (`id`) USING BTREE,
  37. KEY `mall_id` (`mall_id`) USING BTREE,
  38. KEY `change_pos_id` (`change_pos_id`) USING BTREE
  39. ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC COMMENT='位置交换平台补贴用户变动表';";
  40. $this->execute($sql);
  41. }
  42. /**
  43. * {@inheritdoc}
  44. */
  45. public function safeDown()
  46. {
  47. echo "M230602151236QimallAddonsDoubleCopyChangePos 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 "M230602151236QimallAddonsDoubleCopyChangePos cannot be reverted.\n";
  58. return false;
  59. }
  60. */
  61. }