49 lines
1.8 KiB
SQL
49 lines
1.8 KiB
SQL
CREATE TABLE `notebooks` (
|
|
`id` text NOT NULL,
|
|
`user_id` text NOT NULL,
|
|
`name` text NOT NULL,
|
|
`context_id` text,
|
|
`is_private` integer DEFAULT false NOT NULL,
|
|
`sort_order` integer DEFAULT 0 NOT NULL,
|
|
`updated_at` text NOT NULL,
|
|
`deleted_at` text,
|
|
`purged_at` text,
|
|
`version` integer DEFAULT 1 NOT NULL,
|
|
PRIMARY KEY(`id`, `user_id`)
|
|
);
|
|
--> statement-breakpoint
|
|
CREATE INDEX `notebooks_updated_at_idx` ON `notebooks` (`updated_at`);--> statement-breakpoint
|
|
CREATE INDEX `notebooks_user_id_idx` ON `notebooks` (`user_id`);--> statement-breakpoint
|
|
CREATE TABLE `page_notebooks` (
|
|
`id` text NOT NULL,
|
|
`user_id` text NOT NULL,
|
|
`page_id` text NOT NULL,
|
|
`notebook_id` text NOT NULL,
|
|
`sort_order` integer DEFAULT 0 NOT NULL,
|
|
`updated_at` text NOT NULL,
|
|
`deleted_at` text,
|
|
`purged_at` text,
|
|
`version` integer DEFAULT 1 NOT NULL,
|
|
PRIMARY KEY(`id`, `user_id`)
|
|
);
|
|
--> statement-breakpoint
|
|
CREATE INDEX `page_notebooks_updated_at_idx` ON `page_notebooks` (`updated_at`);--> statement-breakpoint
|
|
CREATE INDEX `page_notebooks_page_id_idx` ON `page_notebooks` (`page_id`);--> statement-breakpoint
|
|
CREATE INDEX `page_notebooks_notebook_id_idx` ON `page_notebooks` (`notebook_id`);--> statement-breakpoint
|
|
CREATE INDEX `page_notebooks_user_id_idx` ON `page_notebooks` (`user_id`);--> statement-breakpoint
|
|
CREATE TABLE `pages` (
|
|
`id` text NOT NULL,
|
|
`user_id` text NOT NULL,
|
|
`title` text NOT NULL,
|
|
`body` text DEFAULT '' NOT NULL,
|
|
`is_private` integer DEFAULT false NOT NULL,
|
|
`sort_order` integer DEFAULT 0 NOT NULL,
|
|
`updated_at` text NOT NULL,
|
|
`deleted_at` text,
|
|
`purged_at` text,
|
|
`version` integer DEFAULT 1 NOT NULL,
|
|
PRIMARY KEY(`id`, `user_id`)
|
|
);
|
|
--> statement-breakpoint
|
|
CREATE INDEX `pages_updated_at_idx` ON `pages` (`updated_at`);--> statement-breakpoint
|
|
CREATE INDEX `pages_user_id_idx` ON `pages` (`user_id`); |