Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 62 additions & 0 deletions drizzle/0002_lovely_stranger.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
CREATE TABLE `catalog_collections` (
`id` text NOT NULL,
`workspace_id` text DEFAULT 'default' NOT NULL,
`space_id` text NOT NULL,
`shard_id` text DEFAULT 'default' NOT NULL,
`title` text NOT NULL,
`created_at` integer NOT NULL,
`updated_at` integer NOT NULL,
PRIMARY KEY(`workspace_id`, `id`),
FOREIGN KEY (`workspace_id`,`space_id`) REFERENCES `spaces`(`workspace_id`,`id`) ON UPDATE no action ON DELETE no action
);
--> statement-breakpoint
CREATE TABLE `catalog_documents` (
`id` text NOT NULL,
`workspace_id` text DEFAULT 'default' NOT NULL,
`space_id` text NOT NULL,
`shard_id` text DEFAULT 'default' NOT NULL,
`title` text NOT NULL,
`parent_document_id` text,
`order` text NOT NULL,
`created_at` integer NOT NULL,
`updated_at` integer NOT NULL,
PRIMARY KEY(`workspace_id`, `id`),
FOREIGN KEY (`workspace_id`,`space_id`) REFERENCES `spaces`(`workspace_id`,`id`) ON UPDATE no action ON DELETE no action
);
--> statement-breakpoint
CREATE TABLE `catalog_outbox` (
`id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
`workspace_id` text DEFAULT 'default' NOT NULL,
`revision` integer NOT NULL,
`status` text NOT NULL,
`operation_id` text NOT NULL,
`payload_json` text NOT NULL,
`created_at` integer NOT NULL,
`published_at` integer
);
--> statement-breakpoint
CREATE TABLE `catalog_revisions` (
`workspace_id` text PRIMARY KEY DEFAULT 'default' NOT NULL,
`revision` integer DEFAULT 0 NOT NULL
);
--> statement-breakpoint
CREATE TABLE `record_locator` (
`id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
`workspace_id` text DEFAULT 'default' NOT NULL,
`record_id` text NOT NULL,
`kind` text NOT NULL,
`space_id` text NOT NULL,
`shard_id` text DEFAULT 'default' NOT NULL,
`created_at` integer NOT NULL,
FOREIGN KEY (`workspace_id`,`space_id`) REFERENCES `spaces`(`workspace_id`,`id`) ON UPDATE no action ON DELETE no action
);
--> statement-breakpoint
CREATE UNIQUE INDEX `record_locator_workspace_record_unique` ON `record_locator` (`workspace_id`,`record_id`);--> statement-breakpoint
CREATE TABLE `spaces` (
`id` text PRIMARY KEY NOT NULL,
`workspace_id` text DEFAULT 'default' NOT NULL,
`name` text NOT NULL,
`created_at` integer NOT NULL
);
--> statement-breakpoint
CREATE UNIQUE INDEX `spaces_workspace_id_unique` ON `spaces` (`workspace_id`,`id`);
Loading
Loading