From 1083b8aa946757a4bdcd8ace04538bd5f9e932ff Mon Sep 17 00:00:00 2001 From: FatttSnake Date: Mon, 22 Apr 2024 13:30:03 +0800 Subject: [PATCH] Refactor(Database): Update database Update database unique key and format SQL --- .../master/V1_0_0_231019__Add_table_'t_s_user'.sql | 13 ++++++------- ...1_0_0_240103__Add_table_‘t_s_sensitive_word'.sql | 10 +++++----- ...V1_0_0_240116__Add_table_'t_b_tool_category'.sql | 2 +- ...V1_0_0_240119__Add_table_'t_b_tool_template'.sql | 2 +- .../V1_0_0_240120__Add_table_'t_b_tool_base'.sql | 4 ++-- .../V1_0_0_231212__Add_table_'t_l_sys_log'.sql | 12 ++++++------ ...1_0_0_231214__Add_table_'t_l_statistics_log'.sql | 2 +- 7 files changed, 22 insertions(+), 23 deletions(-) diff --git a/src/main/resources/db/migration/master/V1_0_0_231019__Add_table_'t_s_user'.sql b/src/main/resources/db/migration/master/V1_0_0_231019__Add_table_'t_s_user'.sql index 4526913..490aa4a 100644 --- a/src/main/resources/db/migration/master/V1_0_0_231019__Add_table_'t_s_user'.sql +++ b/src/main/resources/db/migration/master/V1_0_0_231019__Add_table_'t_s_user'.sql @@ -9,19 +9,18 @@ create table if not exists t_s_user verify varchar(144) null comment '验证邮箱', forget varchar(144) null comment '忘记密码', locking int not null comment '锁定', - expiration datetime comment '过期时间', - credentials_expiration datetime comment '认证过期时间', + expiration datetime null comment '过期时间', + credentials_expiration datetime null comment '认证过期时间', enable int not null comment '启用', - current_login_time datetime comment '当前登录时间', - current_login_ip varchar(128) comment '当前登录 IP', - last_login_time datetime comment '上次登录时间', - last_login_ip varchar(128) comment '上次登录 IP', + current_login_time datetime null comment '当前登录时间', + current_login_ip varchar(128) null comment '当前登录 IP', + last_login_time datetime null comment '上次登录时间', + last_login_ip varchar(128) null comment '上次登录 IP', create_time datetime not null default (utc_timestamp()) comment '创建时间', update_time datetime not null default (utc_timestamp()) comment '修改时间', deleted bigint not null default 0, version int not null default 0, constraint t_s_user_unique_username unique (username, deleted), - constraint t_s_user_unique_two_factor unique (two_factor, deleted), constraint t_s_user_unique_verify unique (verify, deleted), constraint t_s_user_unique_forget unique (forget, deleted) ) comment '系统-用户表'; \ No newline at end of file diff --git a/src/main/resources/db/migration/master/V1_0_0_240103__Add_table_‘t_s_sensitive_word'.sql b/src/main/resources/db/migration/master/V1_0_0_240103__Add_table_‘t_s_sensitive_word'.sql index 5177ab7..d6c2830 100644 --- a/src/main/resources/db/migration/master/V1_0_0_240103__Add_table_‘t_s_sensitive_word'.sql +++ b/src/main/resources/db/migration/master/V1_0_0_240103__Add_table_‘t_s_sensitive_word'.sql @@ -2,11 +2,11 @@ drop table if exists t_s_sensitive_word; create table if not exists t_s_sensitive_word ( - id bigint not null primary key, - word varchar(400) not null comment '词', + id bigint not null primary key, + word varchar(400) not null comment '词', use_for varchar(50) null comment '用于', - enable int not null default 1 comment '启用', - deleted bigint not null default 0, - version int not null default 0, + enable int not null default 1 comment '启用', + deleted bigint not null default 0, + version int not null default 0, constraint t_s_sensitive_word_unique_word unique (word, deleted) ) comment '系统-敏感词表'; \ No newline at end of file diff --git a/src/main/resources/db/migration/master/V1_0_0_240116__Add_table_'t_b_tool_category'.sql b/src/main/resources/db/migration/master/V1_0_0_240116__Add_table_'t_b_tool_category'.sql index 21a15d5..1b5ef6e 100644 --- a/src/main/resources/db/migration/master/V1_0_0_240116__Add_table_'t_b_tool_category'.sql +++ b/src/main/resources/db/migration/master/V1_0_0_240116__Add_table_'t_b_tool_category'.sql @@ -3,7 +3,7 @@ drop table if exists t_b_tool_category; create table if not exists t_b_tool_category ( id bigint not null primary key, - name varchar(50) not null comment '工具类别名', + name varchar(50) not null comment '类别名', enable int not null default 1 comment '启用', create_time datetime not null default (utc_timestamp()) comment '创建时间', update_time datetime not null default (utc_timestamp()) comment '修改时间', diff --git a/src/main/resources/db/migration/master/V1_0_0_240119__Add_table_'t_b_tool_template'.sql b/src/main/resources/db/migration/master/V1_0_0_240119__Add_table_'t_b_tool_template'.sql index 899b171..3b4bd89 100644 --- a/src/main/resources/db/migration/master/V1_0_0_240119__Add_table_'t_b_tool_template'.sql +++ b/src/main/resources/db/migration/master/V1_0_0_240119__Add_table_'t_b_tool_template'.sql @@ -14,4 +14,4 @@ create table if not exists t_b_tool_template deleted bigint not null default 0, version int not null default 0, constraint t_b_tool_template_unique_name_platform unique (name, platform, deleted) -) comment '工具-模板表' \ No newline at end of file +) comment '工具-模板表'; \ No newline at end of file diff --git a/src/main/resources/db/migration/master/V1_0_0_240120__Add_table_'t_b_tool_base'.sql b/src/main/resources/db/migration/master/V1_0_0_240120__Add_table_'t_b_tool_base'.sql index 8531682..0956bf6 100644 --- a/src/main/resources/db/migration/master/V1_0_0_240120__Add_table_'t_b_tool_base'.sql +++ b/src/main/resources/db/migration/master/V1_0_0_240120__Add_table_'t_b_tool_base'.sql @@ -6,11 +6,11 @@ create table if not exists t_b_tool_base name varchar(20) not null comment '基板名', source_id bigint not null comment '源码 ID', dist_id bigint not null comment '产物 ID', - platform varchar(20) not null comment '平台', + platform varchar(20) not null comment '平台', compiled int not null default 0 comment '已编译', create_time datetime not null default (utc_timestamp()) comment '创建时间', update_time datetime not null default (utc_timestamp()) comment '修改时间', deleted bigint not null default 0, version int not null default 0, constraint t_b_tool_base_unique_name_platform unique (name, platform, deleted) -) \ No newline at end of file +) comment '工具-基板表'; \ No newline at end of file diff --git a/src/main/resources/db/migration/sqlite/V1_0_0_231212__Add_table_'t_l_sys_log'.sql b/src/main/resources/db/migration/sqlite/V1_0_0_231212__Add_table_'t_l_sys_log'.sql index a49c66c..ba3c20a 100644 --- a/src/main/resources/db/migration/sqlite/V1_0_0_231212__Add_table_'t_l_sys_log'.sql +++ b/src/main/resources/db/migration/sqlite/V1_0_0_231212__Add_table_'t_l_sys_log'.sql @@ -6,15 +6,15 @@ create table t_l_sys_log -- 本地-系统日志表 log_type text not null, -- 日志类型 operate_user_id integer not null, -- 操作用户 operate_time text not null default (strftime('%Y-%m-%d %H:%M:%f', 'now')), -- 操作时间 - request_uri text default null, -- 请求 URI - request_method text default null, -- 请求方式 - request_params text, -- 请求参数 + request_uri text null default null, -- 请求 URI + request_method text null default null, -- 请求方式 + request_params text null, -- 请求参数 request_ip text not null, -- 请求 IP request_server_address text not null, -- 请求服务器地址 exception integer not null default 0, -- 是否异常 - exception_info text, -- 异常信息 + exception_info text null, -- 异常信息 start_time text not null, -- 开始时间 end_time text not null, -- 结束时间 - execute_time integer default null, -- 执行时间 - user_agent text default null -- 用户代理 + execute_time integer null default null, -- 执行时间 + user_agent text null default null -- 用户代理 ); \ No newline at end of file diff --git a/src/main/resources/db/migration/sqlite/V1_0_0_231214__Add_table_'t_l_statistics_log'.sql b/src/main/resources/db/migration/sqlite/V1_0_0_231214__Add_table_'t_l_statistics_log'.sql index 2fb9390..8f8331a 100644 --- a/src/main/resources/db/migration/sqlite/V1_0_0_231214__Add_table_'t_l_statistics_log'.sql +++ b/src/main/resources/db/migration/sqlite/V1_0_0_231214__Add_table_'t_l_statistics_log'.sql @@ -6,4 +6,4 @@ create table if not exists t_l_statistics_log -- 本地-统计日志表 key text not null, -- 记录键 value text not null, -- 记录值 record_time text not null default (strftime('%Y-%m-%d %H:%M:%f', 'now')) -- 记录时间 -) \ No newline at end of file +); \ No newline at end of file