外键约束

This commit is contained in:
禾几海
2020-08-04 22:01:02 +08:00
parent d50cd93e55
commit c6a97e4c5b
2 changed files with 5 additions and 3 deletions

View File

@@ -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 '评论/留言表';