维护表结构

This commit is contained in:
suxiang
2024-09-18 12:44:48 +08:00
parent b08bef691f
commit b6224c42e7
3 changed files with 34 additions and 23 deletions
@@ -102,7 +102,6 @@ CREATE TABLE IF NOT EXISTS `port_mapping` (
`id` int NOT NULL AUTO_INCREMENT COMMENT '主键ID',
`license_id` int NOT NULL COMMENT 'licenseID',
`protocal` varchar(10) NOT NULL DEFAULT 'TCP' COMMENT '协议',
`subdomain` varchar(50) DEFAULT NULL COMMENT '子域名(仅HTTP时有效)',
`server_port` int NOT NULL COMMENT '服务端端口',
`client_ip` varchar(20) NOT NULL COMMENT '客户端IP',
`client_port` int NOT NULL COMMENT '客户端端口',
@@ -119,6 +118,34 @@ CREATE TABLE IF NOT EXISTS `port_mapping` (
PRIMARY KEY (`id`),
KEY `I_port_mapping_server_port` (`server_port`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
#
CREATE TABLE IF NOT EXISTS `domain_name` (
`id` int NOT NULL AUTO_INCREMENT COMMENT '主键ID',
`domain` varchar(50) NOT NULL COMMENT '域名',
`user_id` int NOT NULL COMMENT '用户Id',
`jks` BLOB DEFAULT NULL COMMENT 'jks文件',
`key_store_password` varchar(255) DEFAULT NULL COMMENT 'jks密码',
`is_default` int(2) NOT NULL COMMENT '是否开启默认域名(1、开启 2、关闭)',
`force_https` int(2) NOT NULL COMMENT '是否启用强制https(1、开启 2、关闭)',
`enable` int(2) NOT NULL COMMENT '是否启用(1、启用 2、禁用)',
`create_time` datetime NOT NULL COMMENT '创建时间',
`update_time` datetime NOT NULL COMMENT '更新时间',
PRIMARY KEY (`id`),
UNIQUE INDEX `I_domain_name_domain` (`domain` ASC)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
#
CREATE TABLE IF NOT EXISTS `domain_port_mapping` (
`id` int NOT NULL AUTO_INCREMENT COMMENT '创建时间',
`subdomain` varchar(50) NOT NULL COMMENT '子域名',
`domain_name_id` int NOT NULL COMMENT '域名Id',
`port_mapping_id` int NOT NULL COMMENT '端口映射Id',
PRIMARY KEY (`id`),
UNIQUE INDEX `I_unique_domain_port_mapping` (`domain_name_id` ASC, `subdomain` ASC),
INDEX `I_domain_port_mapping_domain_name_id` (`domain_name_id` ASC),
INDEX `I_domain_port_mapping_port_mapping_id` (`port_mapping_id` ASC)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
##########################################################
#
CREATE TABLE IF NOT EXISTS `user_login_record` (
@@ -1,7 +1,7 @@
#port_mapping
INSERT INTO port_mapping(`id`, `license_id`, `server_port`, `protocal`, `subdomain`, `client_ip`, `client_port`, `is_online`, `enable`, `create_time`, `update_time`) VALUES
(1, 1, 9101, 'HTTP', 'test1', '127.0.0.1', 8080, 2, 1, now(), now());
INSERT INTO port_mapping(`id`, `license_id`, `server_port`, `protocal`, `subdomain`, `client_ip`, `client_port`, `is_online`, `enable`, `create_time`, `update_time`) VALUES
(2, 1, 9102, 'TCP', '', '127.0.0.1', 3306, 2, 1, now(), now());
INSERT INTO port_mapping(`id`, `license_id`, `server_port`, `protocal`, `subdomain`, `client_ip`, `client_port`, `is_online`, `enable`, `create_time`, `update_time`) VALUES
(3, 1, 9103, 'HTTP', 'test2', '127.0.0.1', 8081, 2, 1, now(), now());
INSERT INTO port_mapping(`id`, `license_id`, `server_port`, `protocal`, `client_ip`, `client_port`, `is_online`, `enable`, `create_time`, `update_time`) VALUES
(1, 1, 9101, 'HTTP', '127.0.0.1', 8080, 2, 1, now(), now());
INSERT INTO port_mapping(`id`, `license_id`, `server_port`, `protocal`, `client_ip`, `client_port`, `is_online`, `enable`, `create_time`, `update_time`) VALUES
(2, 1, 9102, 'TCP', '127.0.0.1', 3306, 2, 1, now(), now());
INSERT INTO port_mapping(`id`, `license_id`, `server_port`, `protocal`, `client_ip`, `client_port`, `is_online`, `enable`, `create_time`, `update_time`) VALUES
(3, 1, 9103, 'HTTP', '127.0.0.1', 8081, 2, 1, now(), now());
@@ -97,22 +97,6 @@ CREATE TABLE IF NOT EXISTS `license` (
KEY `I_license_key` (`key`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
#
CREATE TABLE IF NOT EXISTS `domain_name` (
`id` int NOT NULL AUTO_INCREMENT COMMENT '主键ID',
`domain` varchar(50) NOT NULL COMMENT '域名',
`user_id` int NOT NULL COMMENT '用户ID',
`jks` BLOB DEFAULT NULL COMMENT 'SSL证书文件',
`key_store_password` varchar(255) DEFAULT NULL COMMENT 'KeyStore密码',
`is_default` int NOT NULL COMMENT '是否是默认域名(1、是 2、否)',
`force_https` int NOT NULL COMMENT '强制使用https(1、是 2、否)',
`enable` int NOT NULL COMMENT '是否启用(1、启用 2、禁用)',
`create_time` datetime(3) NOT NULL COMMENT '创建时间',
`update_time` datetime(3) NOT NULL COMMENT '更新时间',
PRIMARY KEY (`id`) USING BTREE,
KEY `I_domain_name_domain` (`domain`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
#
CREATE TABLE IF NOT EXISTS `port_mapping` (
`id` int NOT NULL AUTO_INCREMENT COMMENT '主键ID',