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
41 changes: 41 additions & 0 deletions apps/daemon/drizzle/0014_elite_mister_fear.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
CREATE TABLE `attachment_blobs` (
`attachment_id` text NOT NULL,
`variant` text NOT NULL,
`blob_id` text NOT NULL,
PRIMARY KEY(`attachment_id`, `variant`),
FOREIGN KEY (`attachment_id`) REFERENCES `attachments`(`attachment_id`) ON UPDATE no action ON DELETE cascade,
FOREIGN KEY (`blob_id`) REFERENCES `blobs`(`blob_id`) ON UPDATE no action ON DELETE no action
);
--> statement-breakpoint
CREATE INDEX `attachment_blobs_blob_idx` ON `attachment_blobs` (`blob_id`);--> statement-breakpoint
CREATE TABLE `attachments` (
`attachment_id` text PRIMARY KEY NOT NULL,
`kind` text NOT NULL,
`name` text NOT NULL,
`mime_type` text NOT NULL,
`size_bytes` integer NOT NULL,
`metadata_json` text NOT NULL,
`created_at` integer NOT NULL
);
--> statement-breakpoint
CREATE TABLE `blobs` (
`blob_id` text PRIMARY KEY NOT NULL,
`size_bytes` integer NOT NULL,
`created_at` integer NOT NULL
);
--> statement-breakpoint
CREATE TABLE `upload_leases` (
`upload_id` text PRIMARY KEY NOT NULL,
`declared_sha256` text NOT NULL,
`declared_size` integer NOT NULL,
`name` text NOT NULL,
`mime_type` text,
`kind` text NOT NULL,
`blob_id` text,
`attachment_id` text,
`expires_at` integer NOT NULL,
`created_at` integer NOT NULL
);
--> statement-breakpoint
CREATE INDEX `upload_leases_expires_at_idx` ON `upload_leases` (`expires_at`);--> statement-breakpoint
ALTER TABLE `session_resources` ADD `attachment_id` text;
Loading
Loading