feat: 工作台聊天室功能
This commit is contained in:
24
drizzle/0002_orange_black_knight.sql
Normal file
24
drizzle/0002_orange_black_knight.sql
Normal file
@@ -0,0 +1,24 @@
|
||||
CREATE TABLE `conversations` (
|
||||
`created_at` text NOT NULL,
|
||||
`id` text PRIMARY KEY NOT NULL,
|
||||
`model_id` text NOT NULL,
|
||||
`project_id` text NOT NULL,
|
||||
`title` text DEFAULT '新会话' NOT NULL,
|
||||
`updated_at` text NOT NULL,
|
||||
FOREIGN KEY (`model_id`) REFERENCES `models`(`id`) ON UPDATE no action ON DELETE no action,
|
||||
FOREIGN KEY (`project_id`) REFERENCES `projects`(`id`) ON UPDATE no action ON DELETE no action
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE INDEX `conversations_project_id_idx` ON `conversations` (`project_id`);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE `messages` (
|
||||
`content` text DEFAULT '' NOT NULL,
|
||||
`conversation_id` text NOT NULL,
|
||||
`created_at` text NOT NULL,
|
||||
`id` text PRIMARY KEY NOT NULL,
|
||||
`parts` text,
|
||||
`role` text NOT NULL,
|
||||
FOREIGN KEY (`conversation_id`) REFERENCES `conversations`(`id`) ON UPDATE no action ON DELETE cascade
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE INDEX `messages_conversation_id_idx` ON `messages` (`conversation_id`);
|
||||
Reference in New Issue
Block a user