aboutsummaryrefslogtreecommitdiff
path: root/apps/web/db/prepare.sql
diff options
context:
space:
mode:
authorDhravya <[email protected]>2024-03-30 14:50:42 -0700
committerDhravya <[email protected]>2024-03-30 14:50:42 -0700
commit2e6d1ce574d446c425fc29154b2f55ce5060185e (patch)
treef713b4feed078d3de5b70f3e1c2d1a10542fa9a0 /apps/web/db/prepare.sql
parentadded policy (diff)
downloadsupermemory-2e6d1ce574d446c425fc29154b2f55ce5060185e.tar.xz
supermemory-2e6d1ce574d446c425fc29154b2f55ce5060185e.zip
fix: hot update in dev mode! FINALLY
Diffstat (limited to 'apps/web/db/prepare.sql')
-rw-r--r--apps/web/db/prepare.sql67
1 files changed, 67 insertions, 0 deletions
diff --git a/apps/web/db/prepare.sql b/apps/web/db/prepare.sql
new file mode 100644
index 00000000..a14b8e18
--- /dev/null
+++ b/apps/web/db/prepare.sql
@@ -0,0 +1,67 @@
+CREATE TABLE `account` (
+ `id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
+ `userId` text(255) NOT NULL,
+ `type` text(255) NOT NULL,
+ `provider` text(255) NOT NULL,
+ `providerAccountId` text(255) NOT NULL,
+ `refresh_token` text,
+ `access_token` text,
+ `expires_at` integer,
+ `token_type` text(255),
+ `scope` text(255),
+ `id_token` text,
+ `session_state` text(255),
+ `oauth_token_secret` text,
+ `oauth_token` text,
+ FOREIGN KEY (`userId`) REFERENCES `user`(`id`) ON UPDATE no action ON DELETE no action
+);
+--> statement-breakpoint
+CREATE TABLE `session` (
+ `id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
+ `sessionToken` text(255) NOT NULL,
+ `userId` text(255) NOT NULL,
+ `expires` integer NOT NULL,
+ FOREIGN KEY (`userId`) REFERENCES `user`(`id`) ON UPDATE no action ON DELETE no action
+);
+--> statement-breakpoint
+CREATE TABLE `storedContent` (
+ `id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
+ `content` text NOT NULL,
+ `title` text(255),
+ `description` text(255),
+ `url` text NOT NULL,
+ `savedAt` integer NOT NULL,
+ `baseUrl` text(255),
+ `image` text(255)
+);
+--> statement-breakpoint
+CREATE TABLE `userStoredContent` (
+ `userId` text NOT NULL,
+ `contentId` integer NOT NULL,
+ FOREIGN KEY (`userId`) REFERENCES `user`(`id`) ON UPDATE no action ON DELETE no action,
+ FOREIGN KEY (`contentId`) REFERENCES `storedContent`(`id`) ON UPDATE no action ON DELETE no action
+);
+--> statement-breakpoint
+CREATE TABLE `user` (
+ `id` text(255) PRIMARY KEY NOT NULL,
+ `name` text(255),
+ `email` text(255) NOT NULL,
+ `emailVerified` integer DEFAULT CURRENT_TIMESTAMP,
+ `image` text(255)
+);
+--> statement-breakpoint
+CREATE TABLE `verificationToken` (
+ `identifier` text(255) NOT NULL,
+ `token` text(255) NOT NULL,
+ `expires` integer NOT NULL,
+ PRIMARY KEY(`identifier`, `token`)
+);
+--> statement-breakpoint
+CREATE INDEX `account_userId_idx` ON `account` (`userId`);--> statement-breakpoint
+CREATE INDEX `session_userId_idx` ON `session` (`userId`);--> statement-breakpoint
+CREATE UNIQUE INDEX `storedContent_url_unique` ON `storedContent` (`url`);--> statement-breakpoint
+CREATE INDEX `storedContent_url_idx` ON `storedContent` (`url`);--> statement-breakpoint
+CREATE INDEX `storedContent_savedAt_idx` ON `storedContent` (`savedAt`);--> statement-breakpoint
+CREATE INDEX `storedContent_title_idx` ON `storedContent` (`title`);--> statement-breakpoint
+CREATE INDEX `userStoredContent_idx` ON `userStoredContent` (`userId`,`contentId`);--> statement-breakpoint
+CREATE UNIQUE INDEX `unique_user_content` ON `userStoredContent` (`userId`,`contentId`); \ No newline at end of file