From 2b2ce7fa538ca5b6197ac836b5b1a1e3cbf499ee Mon Sep 17 00:00:00 2001 From: lexluo09 <39718951+lexluo09@users.noreply.github.com> Date: Sat, 29 Jun 2024 23:29:43 +0800 Subject: [PATCH] (improvement)(chat) Initialize the created_at and updated_at timestamps in s2_chat_memory. (#1289) --- .../src/main/resources/config.update/sql-update.sql | 4 ++-- launchers/standalone/src/main/resources/db/schema-h2.sql | 4 ++-- .../standalone/src/main/resources/db/schema-mysql.sql | 4 ++-- launchers/standalone/src/test/resources/db/schema-h2.sql | 9 +++++---- 4 files changed, 11 insertions(+), 10 deletions(-) diff --git a/launchers/standalone/src/main/resources/config.update/sql-update.sql b/launchers/standalone/src/main/resources/config.update/sql-update.sql index 183caa7d3..de4e3e70e 100644 --- a/launchers/standalone/src/main/resources/config.update/sql-update.sql +++ b/launchers/standalone/src/main/resources/config.update/sql-update.sql @@ -342,8 +342,8 @@ CREATE TABLE IF NOT EXISTS `s2_chat_memory` ( `llm_comment` TEXT, `human_review` char(10) , `human_comment` TEXT , - `created_at` datetime NOT NULL , - `updated_at` datetime NOT NULL , + `created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP , + `updated_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP , `created_by` varchar(100) NOT NULL , `updated_by` varchar(100) NOT NULL , PRIMARY KEY (`id`) diff --git a/launchers/standalone/src/main/resources/db/schema-h2.sql b/launchers/standalone/src/main/resources/db/schema-h2.sql index b4a361aa3..53e640a37 100644 --- a/launchers/standalone/src/main/resources/db/schema-h2.sql +++ b/launchers/standalone/src/main/resources/db/schema-h2.sql @@ -94,8 +94,8 @@ CREATE TABLE IF NOT EXISTS `s2_chat_memory` ( `llm_comment` TEXT, `human_review` char(10) , `human_comment` TEXT , - `created_at` TIMESTAMP , - `updated_at` TIMESTAMP , + `created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP , + `updated_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP , `created_by` varchar(100) , `updated_by` varchar(100) , PRIMARY KEY (`id`) diff --git a/launchers/standalone/src/main/resources/db/schema-mysql.sql b/launchers/standalone/src/main/resources/db/schema-mysql.sql index bf1e9fd7a..51c7f2796 100644 --- a/launchers/standalone/src/main/resources/db/schema-mysql.sql +++ b/launchers/standalone/src/main/resources/db/schema-mysql.sql @@ -147,8 +147,8 @@ CREATE TABLE IF NOT EXISTS `s2_chat_memory` ( `llm_comment` TEXT COMMENT '大模型评估意见' , `human_review` char(10) COMMENT '管理员评估结果', `human_comment` TEXT COMMENT '管理员评估意见', - `created_at` datetime DEFAULT NULL , - `updated_at` datetime DEFAULT NULL , + `created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP , + `updated_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP , `created_by` varchar(100) DEFAULT NULL , `updated_by` varchar(100) DEFAULT NULL , PRIMARY KEY (`id`) diff --git a/launchers/standalone/src/test/resources/db/schema-h2.sql b/launchers/standalone/src/test/resources/db/schema-h2.sql index 2c8a73d99..558032a5f 100644 --- a/launchers/standalone/src/test/resources/db/schema-h2.sql +++ b/launchers/standalone/src/test/resources/db/schema-h2.sql @@ -82,6 +82,7 @@ CREATE TABLE IF NOT EXISTS `s2_chat_config` ( ) ; COMMENT ON TABLE s2_chat_config IS 'chat config information table '; + CREATE TABLE IF NOT EXISTS `s2_chat_memory` ( `id` INT NOT NULL AUTO_INCREMENT, `question` varchar(655) , @@ -93,8 +94,8 @@ CREATE TABLE IF NOT EXISTS `s2_chat_memory` ( `llm_comment` TEXT, `human_review` char(10) , `human_comment` TEXT , - `created_at` TIMESTAMP , - `updated_at` TIMESTAMP , + `created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP , + `updated_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP , `created_by` varchar(100) , `updated_by` varchar(100) , PRIMARY KEY (`id`) @@ -106,10 +107,10 @@ create table IF NOT EXISTS s2_user id INT AUTO_INCREMENT, name varchar(100) not null, display_name varchar(100) null, - password varchar(100) null, + password varchar(256) null, + salt varchar(256) NULL, email varchar(100) null, is_admin INT null, - salt varchar(100) null, PRIMARY KEY (`id`) ); COMMENT ON TABLE s2_user IS 'user information table';