27 lines
877 B
SQL
27 lines
877 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,
|
|
`github_org` text,
|
|
`github_repo` text
|
|
);
|
|
--> 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
|
|
);
|