Skip to content

v2.1.0

sql 脚本 - 数据迁移

sql
-- 编辑 host 表
ALTER TABLE `host` 
ADD COLUMN `type` char(8) NULL COMMENT '主机类型' AFTER `id`,
ADD COLUMN `port` int(0) NULL COMMENT '主机端口' AFTER `address`,
ADD COLUMN `status` char(8) NULL COMMENT '主机状态' AFTER `port`,
ADD COLUMN `config` json NULL COMMENT '主机配置' AFTER `status`;

-- 更新 host 表
UPDATE host h
JOIN host_config hc ON h.id = hc.host_id
SET h.type = 'SSH',
		h.status = IF(hc.status = 0, 'DISABLED', 'ENABLED'),
    h.port = IF(
        hc.config IS NULL OR hc.config = '' OR JSON_UNQUOTE(JSON_EXTRACT(hc.config, '$.port')) IS NULL,
        22,
        JSON_UNQUOTE(JSON_EXTRACT(hc.config, '$.port')) + 0
    ),
	h.config = IF(
        hc.config IS NULL OR hc.config = '',
        JSON_OBJECT(),
        hc.config
    );

-- 删除 host_config 表
DROP TABLE `host_config`;

-- 修改额外配置
UPDATE data_extra SET item = "SSH" WHERE item = "ssh";
UPDATE data_extra SET item = "LABEL" WHERE item = "label";

-- 修改操作日志
UPDATE operator_log SET type = "host:update-status" WHERE type = "host:update-config-status";

sql 脚本 - DML

sql
-- 字典项
DELETE FROM `dict_key` WHERE id IN (57, 58);
INSERT INTO `dict_key` VALUES (57, 'hostStatus', 'STRING', '[{\"name\": \"color\", \"type\": \"COLOR\"}, {\"name\": \"status\", \"type\": \"STRING\"}]', '主机状态', '2024-07-17 12:51:10', '2024-07-22 16:53:23', '1', '1', 0);
INSERT INTO `dict_key` VALUES (58, 'hostType', 'STRING', '[{\"name\": \"color\", \"type\": \"COLOR\"}]', '主机类型', '2024-07-17 12:51:10', '2024-07-22 14:02:44', '1', '1', 0);

-- 字典值
DELETE FROM `dict_value` WHERE id IN (92, 385, 386, 387);
INSERT INTO `dict_value` VALUES (92, 2, 'operatorLogType', 'host:update-status', '修改主机状态', '{}', 50, '2023-10-31 10:55:43', '2024-07-22 14:48:11', '1', '1', 0);
INSERT INTO `dict_value` VALUES (385, 57, 'hostStatus', 'ENABLED', '启用', '{\"color\": \"arcoblue\", \"status\": \"normal\", \"buttonStatus\": \"normal\"}', 10, '2024-07-17 12:51:10', '2024-07-22 16:53:53', '1', '1', 0);
INSERT INTO `dict_value` VALUES (386, 57, 'hostStatus', 'DISABLED', '停用', '{\"color\": \"orangered\", \"status\": \"error\", \"buttonStatus\": \"danger\"}', 20, '2024-07-17 12:51:10', '2024-07-22 16:53:46', '1', '1', 0);
INSERT INTO `dict_value` VALUES (387, 58, 'hostType', 'SSH', 'SSH', '{\"color\": \"arcoblue\"}', 10, '2024-07-17 12:51:10', '2024-07-17 15:57:24', '1', '1', 0);

-- 菜单表
DELETE FROM `system_menu` WHERE id IN (64, 69, 72, 79, 144, 185);
INSERT INTO `system_menu` VALUES (64, 63, '主机管理', NULL, 2, 10, 1, 1, 1, 0, 'IconDesktop', NULL, 'hostList', '2023-09-11 14:17:31', '2024-07-03 18:52:10', '1', '1', 0);
INSERT INTO `system_menu` VALUES (69, 64, '修改状态', 'asset:host:update-status', 3, 50, 1, 1, 1, 0, NULL, NULL, NULL, '2024-07-22 14:49:13', '2024-07-22 14:49:22', '1', '1', 0);
INSERT INTO `system_menu` VALUES (72, 63, '主机身份', NULL, 2, 30, 1, 1, 1, 0, 'IconIdcard', NULL, 'hostIdentity', '2023-09-20 11:47:18', '2024-07-03 18:52:15', '1', '1', 0);
INSERT INTO `system_menu` VALUES (79, 63, '主机密钥', NULL, 2, 20, 1, 1, 1, 0, 'IconLock', NULL, 'hostKey', '2023-09-20 11:47:18', '2024-07-03 18:52:13', '1', '1', 0);
INSERT INTO `system_menu` VALUES (144, 63, '资产授权', NULL, 2, 50, 1, 1, 1, 0, 'icon-safe', NULL, 'assetGrant', '2023-11-30 22:38:57', '2024-07-03 18:52:18', '1', '1', 0);
INSERT INTO `system_menu` VALUES (185, 193, '计划任务日志', NULL, 2, 30, 0, 1, 0, 1, NULL, NULL, 'execJobLogView', '2024-04-11 13:41:47', '2024-07-08 18:10:37', '2', '1', 0);

最后更新:

Released under the Apache 2.0 License.