mirror of
https://github.com/ngthanhvu/kr-phim.git
synced 2026-08-10 12:27:47 +00:00
- Created 0009_snapshot.json with initial structure for comment_votes, comments, movies, and users tables. - Created 0010_snapshot.json with updated structure for comments, including new fields: pinned and spoiler. - Created 0011_snapshot.json with further updates to comments, adding anonymous field and refining existing structures.
14 lines
673 B
SQL
14 lines
673 B
SQL
CREATE TABLE `comment_votes` (
|
|
`id` int AUTO_INCREMENT NOT NULL,
|
|
`user_id` int NOT NULL,
|
|
`comment_id` int NOT NULL,
|
|
`vote` int NOT NULL,
|
|
`created_at` timestamp NOT NULL DEFAULT (now()),
|
|
CONSTRAINT `comment_votes_id` PRIMARY KEY(`id`)
|
|
);
|
|
--> statement-breakpoint
|
|
ALTER TABLE `comments` ADD `parent_id` int;--> statement-breakpoint
|
|
ALTER TABLE `comments` ADD `like_count` int DEFAULT 0 NOT NULL;--> statement-breakpoint
|
|
ALTER TABLE `comments` ADD `dislike_count` int DEFAULT 0 NOT NULL;--> statement-breakpoint
|
|
CREATE INDEX `idx_user_comment` ON `comment_votes` (`user_id`,`comment_id`);--> statement-breakpoint
|
|
CREATE INDEX `idx_parent_id` ON `comments` (`parent_id`); |