Loading files
This file is pinned to the selected release. Download the original to open it in your design tool.
CREATE TABLE `post_comments` (
`id` text PRIMARY KEY NOT NULL,
`post_id` text NOT NULL,
`user_id` text NOT NULL,
`body` text NOT NULL,
`created_at` integer NOT NULL,
FOREIGN KEY (`post_id`) REFERENCES `posts`(`id`) ON UPDATE no action ON DELETE cascade,
FOREIGN KEY (`user_id`) REFERENCES `user`(`id`) ON UPDATE no action ON DELETE cascade
);
--> statement-breakpoint
CREATE INDEX `post_comments_post_id_idx` ON `post_comments` (`post_id`);--> statement-breakpoint
CREATE TABLE `posts` (
`id` text PRIMARY KEY NOT NULL,
`user_id` text NOT NULL,
`title` text NOT NULL,
`body` text NOT NULL,
`created_at` integer NOT NULL,
`updated_at` integer NOT NULL,
FOREIGN KEY (`user_id`) REFERENCES `user`(`id`) ON UPDATE no action ON DELETE cascade
);
--> statement-breakpoint
CREATE INDEX `posts_created_at_idx` ON `posts` (`created_at`);--> statement-breakpoint
CREATE INDEX `posts_user_id_idx` ON `posts` (`user_id`);07e931b46This file is pinned to the selected release. Download the original to open it in your design tool.