Files
moreminimore-vibe/drizzle/0000_mighty_stark_industries.sql
2025-04-11 09:38:16 -07:00

25 lines
836 B
SQL

CREATE TABLE `apps` (
`id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
`name` text NOT NULL,
`path` text NOT NULL,
`created_at` integer DEFAULT (unixepoch()) NOT NULL,
`updated_at` integer DEFAULT (unixepoch()) NOT NULL
);
--> statement-breakpoint
CREATE TABLE `chats` (
`id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
`app_id` integer NOT NULL,
`title` text,
`created_at` integer DEFAULT (unixepoch()) NOT NULL,
FOREIGN KEY (`app_id`) REFERENCES `apps`(`id`) ON UPDATE no action ON DELETE cascade
);
--> statement-breakpoint
CREATE TABLE `messages` (
`id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
`chat_id` integer NOT NULL,
`role` text NOT NULL,
`content` text NOT NULL,
`created_at` integer DEFAULT (unixepoch()) NOT NULL,
FOREIGN KEY (`chat_id`) REFERENCES `chats`(`id`) ON UPDATE no action ON DELETE cascade
);