## v1.0.6

> sql 脚本 - DDL

```sql
-- 数据分组添加 userId
ALTER TABLE `data_group` 
ADD COLUMN `user_id` bigint(0) NULL COMMENT '用户id' AFTER `type`,
MODIFY COLUMN `name` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '组名称' AFTER `user_id`,
DROP INDEX `idx_type`,
ADD INDEX `idx_type_user`(`type`, `user_id`) USING BTREE;

ALTER TABLE `data_group_rel` 
MODIFY COLUMN `type` char(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '组类型' AFTER `id`,
ADD COLUMN `user_id` bigint(0) NULL COMMENT '用户id' AFTER `type`,
DROP INDEX `idx_type`,
ADD INDEX `idx_type_user`(`type`, `user_id`) USING BTREE;

-- 执行模板主机表
DROP TABLE IF EXISTS `exec_template_host`;
CREATE TABLE `exec_template_host`
(
    `id`          bigint(0)                                                    NOT NULL AUTO_INCREMENT COMMENT 'id',
    `template_id` bigint(0)                                                    NULL DEFAULT NULL COMMENT '模板id',
    `host_id`     bigint(0)                                                    NULL DEFAULT NULL COMMENT '主机id',
    `create_time` datetime(0)                                                  NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
    `update_time` datetime(0)                                                  NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '修改时间',
    `creator`     varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '创建人',
    `updater`     varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '更新人',
    `deleted`     tinyint(1)                                                   NULL DEFAULT 0 COMMENT '是否删除 0未删除 1已删除',
    PRIMARY KEY (`id`) USING BTREE,
    INDEX `template_id` (`template_id`) USING BTREE
) ENGINE = InnoDB
  AUTO_INCREMENT = 1
  CHARACTER SET = utf8mb4
  COLLATE = utf8mb4_general_ci COMMENT = '执行模板主机'
  ROW_FORMAT = Dynamic;

-- 路径书签表
DROP TABLE IF EXISTS `path_bookmark`;
CREATE TABLE `path_bookmark`
(
    `id`          bigint(0)                                                      NOT NULL AUTO_INCREMENT COMMENT 'id',
    `user_id`     bigint(0)                                                      NULL DEFAULT NULL COMMENT '用户id',
    `group_id`    bigint(0)                                                      NULL DEFAULT NULL COMMENT '分组id',
    `name`        varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci   NULL DEFAULT NULL COMMENT '名称',
    `type`        char(4) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci       NULL DEFAULT NULL COMMENT '类型',
    `path`        varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '路径',
    `create_time` datetime(0)                                                    NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
    `update_time` datetime(0)                                                    NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '修改时间',
    `creator`     varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci   NULL DEFAULT NULL COMMENT '创建人',
    `updater`     varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci   NULL DEFAULT NULL COMMENT '更新人',
    `deleted`     tinyint(1)                                                     NULL DEFAULT 0 COMMENT '是否删除 0未删除 1已删除',
    PRIMARY KEY (`id`) USING BTREE,
    INDEX `idx_user` (`user_id`) USING BTREE
) ENGINE = InnoDB
  AUTO_INCREMENT = 1
  CHARACTER SET = utf8mb4
  COLLATE = utf8mb4_general_ci COMMENT = '路径书签'
  ROW_FORMAT = Dynamic;

```

> sql 脚本 - DML

```sql
-- 设置数据分组 user_id
UPDATE data_group SET user_id = 0;
UPDATE data_group_rel SET user_id = 0;
-- 菜单
DELETE FROM `system_menu` WHERE id >= 190;
INSERT INTO `system_menu` VALUES (190, 184, '中断计划任务', 'asset:exec-job-log:interrupt', 3, 40, 1, 1, 1, 0, NULL, NULL, NULL, '2024-03-13 15:08:23', '2024-04-12 00:00:33', '1', '1', 0);
INSERT INTO `system_menu` VALUES (191, 0, '提交bug', NULL, 1, 1020, 1, 1, 0, 1, 'IconBug', 'https://github.com/lijiahangmax/orion-visor/issues', NULL, '2024-04-26 11:30:18', '2024-04-26 11:30:30', '1', '1', 0);
INSERT INTO `system_menu` VALUES (192, 0, '点个赞~', NULL, 1, 1030, 1, 1, 0, 1, 'IconThumbUp', 'https://gitee.com/lijiahangmax/orion-visor', NULL, '2024-04-26 11:32:30', '2024-04-26 11:32:30', '1', '1', 0);
-- 字典项
DELETE FROM `dict_key` WHERE id = 27 OR id >= 39;
INSERT INTO `dict_key` VALUES (27, 'hostConnectType', 'STRING', '[{\"name\": \"color\", \"type\": \"COLOR\"}]', '主机连接类型', '2023-12-26 23:23:08', '2024-04-24 16:37:48', '1', '1', 0);
INSERT INTO `dict_key` VALUES (39, 'pathBookmarkType', 'STRING', '[]', '路径标签类型', '2024-04-24 13:43:12', '2024-04-24 13:43:12', '1', '1', 0);
-- 字典值
DELETE FROM `dict_value` WHERE id IN (7, 9, 18, 21, 176, 193) OR id >= 274;
INSERT INTO `dict_value` VALUES (7, 5, 'systemMenuStatus', '1', '启用', '{\"color\": \"arcoblue\"}', 20, '2023-10-26 17:00:54', '2024-04-24 16:35:09', '1', '1', 0);
INSERT INTO `dict_value` VALUES (9, 6, 'systemMenuVisible', '1', '显示', '{\"color\": \"arcoblue\"}', 20, '2023-10-27 00:25:30', '2024-04-24 16:35:05', '1', '1', 0);
INSERT INTO `dict_value` VALUES (18, 9, 'systemUserStatus', '1', '启用', '{\"color\": \"arcoblue\"}', 20, '2023-10-27 12:13:17', '2024-04-24 16:35:00', '1', '1', 0);
INSERT INTO `dict_value` VALUES (21, 10, 'systemRoleStatus', '1', '启用', '{\"color\": \"arcoblue\", \"status\": \"default\"}', 20, '2023-10-27 12:33:56', '2024-04-24 16:34:52', '1', '1', 0);
INSERT INTO `dict_value` VALUES (176, 27, 'hostConnectType', 'SSH', 'SSH', '{\"color\": \"arcoblue\"}', 10, '2023-12-26 23:23:18', '2024-04-24 16:38:28', '1', '1', 0);
INSERT INTO `dict_value` VALUES (193, 27, 'hostConnectType', 'SFTP', 'SFTP', '{\"color\": \"purple\"}', 20, '2024-02-04 18:23:10', '2024-04-24 16:38:22', '1', '1', 0);
INSERT INTO `dict_value` VALUES (274, 39, 'pathBookmarkType', 'FILE', '文件', '{}', 10, '2024-04-24 13:43:28', '2024-04-24 13:43:28', '1', '1', 0);
INSERT INTO `dict_value` VALUES (275, 39, 'pathBookmarkType', 'DIR', '文件夹', '{}', 20, '2024-04-24 13:43:39', '2024-04-24 13:43:39', '1', '1', 0);
```

> sql 脚本 - 命令分组初始化

```sql
-- 插入命令片段分组
INSERT INTO `data_group` (`parent_id`, `type`, `user_id`, `name`, `sort`, `creator`, `updater`, `deleted`) 
SELECT 0, 'COMMAND_SNIPPET', user_id, name, id, creator, updater, deleted
FROM command_snippet_group;

-- 需要命令分组 groupId
UPDATE command_snippet s
LEFT JOIN data_group g ON g.type = 'COMMAND_SNIPPET' AND g.sort = s.group_id
SET s.group_id = g.id;

-- 删除命令片段分组表
DROP TABLE IF EXISTS `command_snippet_group`;
```
