From 6822a1153944870d96b42e564ab3a7473a4ac4d9 Mon Sep 17 00:00:00 2001 From: Rekord <1324596506@qq.com> Date: Sat, 11 Mar 2023 13:58:18 +0800 Subject: [PATCH] fix: fix duplicate foreign key constraint error --- src/main/resources/sql/schema.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/resources/sql/schema.sql b/src/main/resources/sql/schema.sql index e5602be..afb4042 100644 --- a/src/main/resources/sql/schema.sql +++ b/src/main/resources/sql/schema.sql @@ -42,7 +42,7 @@ create table if not exists `message` ( `create_time` timestamp default current_timestamp comment '消息发送时间', `update_time` timestamp default current_timestamp on update current_timestamp comment '更新时间', primary key `pk_id` (`id`), - constraint `fk_from_id` foreign key (`from_id`) references `user` (`id`) on delete cascade + constraint `fk_message_from_id` foreign key (`from_id`) references `user` (`id`) on delete cascade ) ENGINE=InnoDB DEFAULT charset=utf8mb4; @@ -95,7 +95,7 @@ create table if not exists `remark` ( `create_time` timestamp default current_timestamp comment '创建时间', `update_time` timestamp default current_timestamp on update current_timestamp comment '更新时间', primary key `pk_id` (`id`), - constraint `fk_from_id` foreign key (`from_id`) references `user` (`id`) on delete cascade + constraint `fk_remark_from_id` foreign key (`from_id`) references `user` (`id`) on delete cascade ) engine=InnoDB auto_increment=501 default charset=utf8mb4 comment="备注表"; set foreign_key_checks = 1;