task/3382: Fix table comment & comment_thread - missed sql file.

This commit is contained in:
Tom Zhao 2024-06-19 15:22:11 +02:00
parent 251708adbb
commit f97c07387e

@ -536,4 +536,36 @@ alter table `note`
foreign key (user_id)
references user(id)
on delete cascade
on update cascade;
-- table comment & comment_thread
alter table `comment` drop foreign key `FK38A5EE5FE44F4DBE`;
alter table `comment` drop foreign key `FK38A5EE5F45F802F5`;
alter table `comment` drop key `FK38A5EE5FE44F4DBE`;
alter table `comment` drop key `FK38A5EE5F45F802F5`;
alter table `comment_thread` drop key `UK_s0ve8ppa3snl8i1wocqwiuwn2`;
alter table `comment_thread` drop key `commentableKey`;
alter table comment_thread rename column `commentableId` to `commentable_id`;
alter table comment_thread rename column `commentableKey` to `commentable_key`;
alter table `comment_thread` add constraint uk_comment_thread_id_key unique(commentable_id, commentable_key);
alter table comment rename column `commentThread_id` to `comment_thread_id`;
alter table comment rename column `creator_id` to `user_id`;
alter table `comment`
add constraint fk_comment_user_id
foreign key (user_id)
references user(id)
on delete cascade
on update cascade;
alter table `comment`
add constraint fk_comment_comment_thread_id
foreign key (comment_thread_id)
references comment_thread(id)
on delete cascade
on update cascade;