Skip to content

v1.0.5

sql 脚本 - DDL

sql
ALTER TABLE `system_user` 
MODIFY COLUMN `status` tinyint(0) NULL DEFAULT 1 COMMENT '用户状态 0停用 1启用' AFTER `email`;

ALTER TABLE `host_identity` 
ADD COLUMN `type` char(12) NULL COMMENT '类型' AFTER `name`;

ALTER TABLE `exec_log` 
ADD COLUMN `script_exec` tinyint(0) NULL DEFAULT 0 COMMENT '是否使用脚本执行' AFTER `timeout`;

ALTER TABLE `exec_job` 
ADD COLUMN `script_exec` tinyint(0) NULL DEFAULT 0 COMMENT '是否使用脚本执行' AFTER `timeout`;

ALTER TABLE `exec_template` 
ADD COLUMN `script_exec` tinyint(0) NULL DEFAULT 0 COMMENT '是否使用脚本执行' AFTER `timeout`;

ALTER TABLE `exec_host_log` 
ADD COLUMN `script_path` varchar(512) NULL COMMENT '脚本路径' AFTER `log_path`;

sql 脚本 - DML

sql
-- 初始化主机身份类型
UPDATE `host_identity` SET type = IF(key_id IS NOT NULL, 'KEY', 'PASSWORD');
-- 重新设置用户状态
UPDATE `system_user` SET status = 0 WHERE status = 2;
DELETE FROM `dict_value` WHERE id = 19;
-- 设置主机配置中的 osType
UPDATE host_config SET config = JSON_SET(config, '$.osType', 'LINUX') WHERE type = 'ssh' AND deleted = 0;
-- 重新设置额外数据
UPDATE data_extra alias
LEFT JOIN data_extra color 
ON alias.user_id = color.user_id 
AND alias.rel_id = color.rel_id 
AND alias.type= color.type
AND color.item = 'color'
SET alias.item = 'label',
alias.value = JSON_OBJECT('alias', JSON_EXTRACT(alias.value, '$.value'), 'color', JSON_EXTRACT(color.value, '$.color')) 
WHERE alias.item = 'alias';
-- 删除 color 数据
DELETE FROM data_extra WHERE type = 'HOST' AND item = 'color';
-- 初始化字典项
DELETE FROM dict_key WHERE id >= 37;
INSERT INTO `dict_key` VALUES (37, 'hostIdentityType', 'STRING', '[{\"name\": \"color\", \"type\": \"COLOR\"}]', '主机身份类型', '2024-04-16 17:15:31', '2024-04-16 17:15:31', '2', '2', 0);
INSERT INTO `dict_key` VALUES (38, 'hostSshOsType', 'STRING', '[]', '主机系统类型', '2024-04-16 22:18:59', '2024-04-16 22:30:59', '1', '1', 0);
-- 初始化字典值
DELETE FROM dict_value WHERE id >= 270;
INSERT INTO `dict_value` VALUES (270, 37, 'hostIdentityType', 'PASSWORD', '密码', '{\"color\": \"purple\"}', 10, '2024-04-16 17:17:49', '2024-04-16 17:17:49', '2', '2', 0);
INSERT INTO `dict_value` VALUES (271, 37, 'hostIdentityType', 'KEY', '密钥', '{\"color\": \"arcoblue\"}', 20, '2024-04-16 17:18:12', '2024-04-16 17:18:12', '2', '2', 0);
INSERT INTO `dict_value` VALUES (272, 38, 'hostSshOsType', 'LINUX', 'linux', '{}', 10, '2024-04-16 22:19:25', '2024-04-16 22:30:59', '1', '1', 0);
INSERT INTO `dict_value` VALUES (273, 38, 'hostSshOsType', 'WINDOWS', 'windows', '{}', 20, '2024-04-16 22:19:39', '2024-04-16 22:30:59', '1', '1', 0);

Released under the Apache 2.0 License.