Files
BRETT/server/db/migrations/0010_perpetual_aqueduct.sql
2026-10-03 20:07:49 +02:00

10 lines
710 B
SQL

CREATE TABLE `comment_reactions` (
`comment_id` bigint unsigned NOT NULL,
`user_id` bigint unsigned NOT NULL,
`emoji` varchar(32) NOT NULL,
`created_at` timestamp NOT NULL DEFAULT (now()),
CONSTRAINT `comment_reactions_comment_id_user_id_emoji_pk` PRIMARY KEY(`comment_id`,`user_id`,`emoji`)
);
--> statement-breakpoint
ALTER TABLE `comment_reactions` ADD CONSTRAINT `comment_reactions_comment_id_comments_id_fk` FOREIGN KEY (`comment_id`) REFERENCES `comments`(`id`) ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
ALTER TABLE `comment_reactions` ADD CONSTRAINT `comment_reactions_user_id_users_id_fk` FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON DELETE cascade ON UPDATE no action;