M231219174236InsterQimallAddonsStoreAddons.php 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. <?php
  2. namespace addons\Store\console\migrations;
  3. use yii\db\Migration;
  4. /**
  5. * Class M231219174236InsterQimallAddonsStoreAddons
  6. */
  7. class M231219174236InsterQimallAddonsStoreAddons extends Migration
  8. {
  9. /**
  10. * {@inheritdoc}
  11. */
  12. public function safeUp()
  13. {
  14. $sql = "ALTER TABLE `qimall_addons_store_menu`
  15. ADD COLUMN `addons_name` varchar(50) NULL DEFAULT '' COMMENT '插件标识',
  16. ADD COLUMN `is_addon` tinyint(2) NULL DEFAULT 0 COMMENT '是否插件[0=否,1=是]';";
  17. $sql .= "INSERT INTO `qimall_addons_store_menu`(`id`, `title`, `app_id`, `pid`, `addons_name`, `is_addon`, `url`, `icon`, `level`, `dev`, `sort`, `params`, `tree`, `status`, `created_at`, `updated_at`) VALUES
  18. (100, '应用', '0', 0, '', 0, 'store/client/addons/index', 'el-icon-menu', 2, 0, 999, NULL, '', 1, 0, 0),
  19. (101, '我的应用', '0', 100, '', 0, 'store/client/addons/index', '', 2, 0, 999, NULL, '', 1, 0, 0),
  20. (102, '优惠券', '0', 0, 'Coupon', 1, 'store/coupon/index/index', '', 2, 0, 999, NULL, '', 1, 0, 0),
  21. (103, '优惠券管理', '0', 102, 'Coupon', 1, 'store/coupon/index/index', '', 2, 0, 999, NULL, '', 1, 0, 0),
  22. (104, '会员优惠券', '0', 102, 'Coupon', 1, 'store/coupon/index/user-coupon', '', 2, 0, 999, NULL, '', 1, 0, 0),
  23. (105, '核销', '0', 0, 'Clerk', 1, 'store/clerk/index/index', '', 2, 0, 999, NULL, '', 1, 0, 0),
  24. (106, '核销员', '0', 105, 'Clerk', 1, 'store/clerk/index/index', '', 2, 0, 999, NULL, '', 1, 0, 0),
  25. (107, '核销明细', '0', 105, 'Clerk', 1, 'store/clerk/index/clerk-log', '', 2, 0, 999, NULL, '', 1, 0, 0);";
  26. $sql .= "CREATE TABLE `qimall_addons_store_addons` (
  27. `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
  28. `title` varchar(20) NOT NULL DEFAULT '' COMMENT '中文名',
  29. `name` varchar(100) NOT NULL DEFAULT '' COMMENT '插件名或标识',
  30. `cover` varchar(200) DEFAULT '' COMMENT '封面',
  31. `brief_introduction` varchar(140) DEFAULT '' COMMENT '简单介绍',
  32. `status` tinyint(4) DEFAULT '1' COMMENT '状态[-1:删除;0:禁用;1启用;]',
  33. `created_at` int(10) unsigned DEFAULT '0' COMMENT '创建时间',
  34. `updated_at` int(10) unsigned DEFAULT '0' COMMENT '修改时间',
  35. PRIMARY KEY (`id`) USING BTREE,
  36. KEY `name` (`name`) USING BTREE
  37. ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC COMMENT='门店插件表';";
  38. $sql .= "INSERT INTO `qimall_addons_store_addons`(`title`, `name`, `cover`, `brief_introduction`, `status`, `created_at`, `updated_at`) VALUES
  39. ('优惠券', 'Coupon', '', '商城优惠券,营销必备', 1, 1702975895, 1702975895),
  40. ('核销', 'Clerk', '', '核销', 1, 1702975895, 1702975895);";
  41. $sql .= "UPDATE `qimall_addons_store_menu` SET `status` = -1 WHERE `id` IN(5,24,25,26,27,28);";
  42. $this->execute($sql);
  43. }
  44. /**
  45. * {@inheritdoc}
  46. */
  47. public function safeDown()
  48. {
  49. echo "M231219174236InsterQimallAddonsStoreAddons cannot be reverted.\n";
  50. return false;
  51. }
  52. /*
  53. // Use up()/down() to run migration code without a transaction.
  54. public function up()
  55. {
  56. }
  57. public function down()
  58. {
  59. echo "M231219174236InsterQimallAddonsStoreAddons cannot be reverted.\n";
  60. return false;
  61. }
  62. */
  63. }