You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

20 lines
1.0 KiB

CREATE TABLE `post_comments` (
`id` integer PRIMARY KEY NOT NULL,
`post_id` integer NOT NULL,
`parent_id` integer,
`author_user_id` integer,
`guest_display_name` text,
`body` text NOT NULL,
`kind` text NOT NULL,
`deleted_at` integer,
`deleted_by_user_id` integer,
`created_at` integer DEFAULT (cast((julianday('now') - 2440587.5)*86400000 as integer)) NOT NULL,
`updated_at` integer DEFAULT (cast((julianday('now') - 2440587.5)*86400000 as integer)) NOT NULL,
FOREIGN KEY (`post_id`) REFERENCES `posts`(`id`) ON UPDATE no action ON DELETE cascade,
FOREIGN KEY (`parent_id`) REFERENCES `post_comments`(`id`) ON UPDATE no action ON DELETE no action,
FOREIGN KEY (`author_user_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE set null,
FOREIGN KEY (`deleted_by_user_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE set null
);
--> statement-breakpoint
CREATE INDEX `post_comments_post_id_idx` ON `post_comments` (`post_id`);--> statement-breakpoint
CREATE INDEX `post_comments_parent_id_idx` ON `post_comments` (`parent_id`);