v2.3.7
sql 脚本1 - DDL
sql
-- 添加主机配置表
CREATE TABLE `host_config` (
`id` bigint NOT NULL AUTO_INCREMENT COMMENT 'id',
`host_id` bigint DEFAULT NULL COMMENT '主机id',
`type` char(8) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '配置类型',
`status` char(8) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '配置状态',
`config` json DEFAULT NULL COMMENT '配置值',
`create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
`creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '创建人',
`updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '更新人',
`deleted` tinyint(1) DEFAULT '0' COMMENT '是否删除 0未删除 1已删除',
PRIMARY KEY (`id`) USING BTREE,
KEY `host_type_idx` (`host_id`,`type`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC COMMENT='主机配置表';
-- 修改主机表
ALTER TABLE `host`
CHANGE COLUMN `type` `types` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '主机类型' AFTER `id`,
ADD COLUMN `arch_type` char(12) NULL COMMENT '系统架构' AFTER `os_type`,
DROP INDEX `idx_type_address`,
ADD INDEX `idx_name`(`name`);
sql 脚本2 - DML
sql
-- 初始化主机配置表
INSERT INTO host_config (host_id, type, status, config, creator, updater, deleted)
SELECT id, 'SSH', status, config, creator, updater, deleted
FROM host;
-- 修改主机配置
UPDATE host_config hc
JOIN host h ON hc.host_id = h.id
SET hc.config = JSON_SET(
COALESCE(hc.config, '{}'),
'$.port',
h.port
);
-- 初始化主机架构
UPDATE host SET arch_type = 'AMD64';
-- 字典项
DELETE FROM dict_key WHERE id = 65;
INSERT INTO dict_key (`id`, `key_name`, `value_type`, `extra_schema`, `description`, `create_time`, `update_time`, `creator`, `updater`, `deleted`) VALUES (65, 'hostArchType', 'STRING', '[]', '主机系统架构', '2025-03-26 16:31:42', '2025-03-26 16:31:42', 'admin', 'admin', 0);
-- 字典值
DELETE FROM dict_value WHERE id IN (272, 273, 452, 448, 449);
INSERT INTO `dict_value` (`id`, `key_id`, `key_name`, `value`, `label`, `extra`, `sort`, `create_time`, `update_time`, `creator`, `updater`, `deleted`) VALUES (272, 38, 'hostOsType', 'LINUX', 'Linux', '{}', 10, '2024-04-16 22:19:25', '2025-03-26 22:46:23', 'admin', 'admin', 0);
INSERT INTO `dict_value` (`id`, `key_id`, `key_name`, `value`, `label`, `extra`, `sort`, `create_time`, `update_time`, `creator`, `updater`, `deleted`) VALUES (273, 38, 'hostOsType', 'WINDOWS', 'Windows', '{}', 20, '2024-04-16 22:19:39', '2025-03-26 22:46:27', 'admin', 'admin', 0);
INSERT INTO `dict_value` (`id`, `key_id`, `key_name`, `value`, `label`, `extra`, `sort`, `create_time`, `update_time`, `creator`, `updater`, `deleted`) VALUES (452, 38, 'hostOsType', 'DRAWIN', 'Drawin', '{}', 30, '2024-04-16 22:19:25', '2025-03-26 22:46:23', 'admin', 'admin', 0);
INSERT INTO `dict_value` (`id`, `key_id`, `key_name`, `value`, `label`, `extra`, `sort`, `create_time`, `update_time`, `creator`, `updater`, `deleted`) VALUES (448, 65, 'hostArchType', 'AMD64', 'amd64', '{}', 10, '2025-03-26 16:33:07', '2025-03-26 16:33:07', 'admin', 'admin', 0);
INSERT INTO `dict_value` (`id`, `key_id`, `key_name`, `value`, `label`, `extra`, `sort`, `create_time`, `update_time`, `creator`, `updater`, `deleted`) VALUES (449, 65, 'hostArchType', 'ARM64', 'arm64', '{}', 20, '2025-03-26 16:33:23', '2025-03-26 16:33:23', 'admin', 'admin', 0);
sql 脚本3 - DDL
sql
-- 删除无用字段
ALTER TABLE `host`
DROP COLUMN `port`,
DROP COLUMN `config`;