aboutsummaryrefslogtreecommitdiff
path: root/apps/web/migrations/000_setup.sql
diff options
context:
space:
mode:
authorDhravya <[email protected]>2024-06-22 17:43:16 -0500
committerDhravya <[email protected]>2024-06-22 17:43:16 -0500
commita2f8a27e771f59380719f2e9997cd926d5d8e83e (patch)
tree58da4ba7bbfc8885d01d79ba01e173f1d1f7906e /apps/web/migrations/000_setup.sql
parentadded multi-turn conversations (diff)
downloadsupermemory-a2f8a27e771f59380719f2e9997cd926d5d8e83e.tar.xz
supermemory-a2f8a27e771f59380719f2e9997cd926d5d8e83e.zip
addeed chathistory functionality
Diffstat (limited to 'apps/web/migrations/000_setup.sql')
-rw-r--r--apps/web/migrations/000_setup.sql21
1 files changed, 20 insertions, 1 deletions
diff --git a/apps/web/migrations/000_setup.sql b/apps/web/migrations/000_setup.sql
index 0c151b98..7e4275b8 100644
--- a/apps/web/migrations/000_setup.sql
+++ b/apps/web/migrations/000_setup.sql
@@ -27,6 +27,23 @@ CREATE TABLE `authenticator` (
FOREIGN KEY (`userId`) REFERENCES `user`(`id`) ON UPDATE no action ON DELETE cascade
);
--> statement-breakpoint
+CREATE TABLE `chatHistory` (
+ `id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
+ `threadId` text NOT NULL,
+ `question` text NOT NULL,
+ `answerParts` text,
+ `answerSources` text,
+ `answerJustification` text,
+ FOREIGN KEY (`threadId`) REFERENCES `chatThread`(`id`) ON UPDATE no action ON DELETE cascade
+);
+--> statement-breakpoint
+CREATE TABLE `chatThread` (
+ `id` text PRIMARY KEY NOT NULL,
+ `firstMessage` text NOT NULL,
+ `userId` text NOT NULL,
+ FOREIGN KEY (`userId`) REFERENCES `user`(`id`) ON UPDATE no action ON DELETE cascade
+);
+--> statement-breakpoint
CREATE TABLE `contentToSpace` (
`contentId` integer NOT NULL,
`spaceId` integer NOT NULL,
@@ -60,7 +77,7 @@ CREATE TABLE `storedContent` (
`ogImage` text(255),
`type` text DEFAULT 'page',
`image` text(255),
- `user` integer,
+ `user` text,
FOREIGN KEY (`user`) REFERENCES `user`(`id`) ON UPDATE no action ON DELETE cascade
);
--> statement-breakpoint
@@ -80,6 +97,8 @@ CREATE TABLE `verificationToken` (
);
--> statement-breakpoint
CREATE UNIQUE INDEX `authenticator_credentialID_unique` ON `authenticator` (`credentialID`);--> statement-breakpoint
+CREATE INDEX `chatHistory_thread_idx` ON `chatHistory` (`threadId`);--> statement-breakpoint
+CREATE INDEX `chatThread_user_idx` ON `chatThread` (`userId`);--> statement-breakpoint
CREATE UNIQUE INDEX `space_name_unique` ON `space` (`name`);--> statement-breakpoint
CREATE INDEX `spaces_name_idx` ON `space` (`name`);--> statement-breakpoint
CREATE INDEX `spaces_user_idx` ON `space` (`user`);--> statement-breakpoint