From c6a97e4c5bec8f8c4769b1c7c1e91791b1945005 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A6=BE=E5=87=A0=E6=B5=B7?= Date: Tue, 4 Aug 2020 22:01:02 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=96=E9=94=AE=E7=BA=A6=E6=9D=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/sql/data.sql | 4 ++-- src/main/resources/sql/schema.sql | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/main/resources/sql/data.sql b/src/main/resources/sql/data.sql index 6289532..93e59ec 100644 --- a/src/main/resources/sql/data.sql +++ b/src/main/resources/sql/data.sql @@ -139,8 +139,8 @@ VALUES (1, 3, 7), INSERT INTO `comment` (`co_id`, `co_page_path`, `co_content`, `co_date`, `co_status`, `co_pid`, `co_from_author_id`, `co_to_author_id`) -VALUES (1, '/a', 'test comment', '2020-05-22 23:57:17', 0, -1, 1, -1), - (2, '/a', 'test comment', '2020-05-22 23:57:31', 0, -1, 1, 1); +VALUES (1, '/a', 'test comment', '2020-05-22 23:57:17', 0, -1, 1, null), + (2, '/a', 'test comment', '2020-05-22 23:57:31', 0, -1, 1, null); diff --git a/src/main/resources/sql/schema.sql b/src/main/resources/sql/schema.sql index c14d7ff..d755609 100644 --- a/src/main/resources/sql/schema.sql +++ b/src/main/resources/sql/schema.sql @@ -74,7 +74,9 @@ CREATE TABLE `comment` `co_status` tinyint not null default 0 comment '评论的状态', `co_pid` bigint not null default -1 comment '评论/留言的父id', `co_from_author_id` int not null comment '留言者id', - `co_to_author_id` int default null comment '父评论的作者id' + `co_to_author_id` int default null comment '父评论的作者id', + foreign key (co_from_author_id) references user (u_id), + foreign key (co_to_author_id) references user (u_id) ) DEFAULT CHARSET = utf8mb4 COLLATE utf8mb4_general_ci,comment '评论/留言表';