aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDhravya Shah <[email protected]>2024-07-23 09:49:13 -0500
committerDhravya Shah <[email protected]>2024-07-23 09:49:13 -0500
commit8d1bb2f59a2a258a13e3675645b24b31fbe1a8b0 (patch)
treed88118a47346cac483c5e4af0e625f37e0417ec6
parentdrop unique constraint on name (diff)
downloadsupermemory-8d1bb2f59a2a258a13e3675645b24b31fbe1a8b0.tar.xz
supermemory-8d1bb2f59a2a258a13e3675645b24b31fbe1a8b0.zip
setup migrations
-rw-r--r--apps/web/migrations/0000_setup.sql (renamed from apps/web/migrations/0000_stormy_catseye.sql)3
-rw-r--r--apps/web/migrations/meta/0000_snapshot.json12
-rw-r--r--apps/web/migrations/meta/_journal.json4
-rw-r--r--apps/web/server/db/schema.ts2
4 files changed, 15 insertions, 6 deletions
diff --git a/apps/web/migrations/0000_stormy_catseye.sql b/apps/web/migrations/0000_setup.sql
index a9b54dce..65a41795 100644
--- a/apps/web/migrations/0000_stormy_catseye.sql
+++ b/apps/web/migrations/0000_setup.sql
@@ -70,7 +70,7 @@ CREATE TABLE `session` (
--> statement-breakpoint
CREATE TABLE `space` (
`id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
- `name` text NOT NULL,
+ `name` text DEFAULT 'none' NOT NULL,
`user` text(255),
`createdAt` integer NOT NULL,
`numItems` integer DEFAULT 0 NOT NULL,
@@ -120,6 +120,7 @@ CREATE UNIQUE INDEX `authenticator_credentialID_unique` ON `authenticator` (`cre
CREATE INDEX `canvas_user_userId` ON `canvas` (`userId`);--> 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
CREATE UNIQUE INDEX `storedContent_baseUrl_unique` ON `storedContent` (`baseUrl`);--> statement-breakpoint
diff --git a/apps/web/migrations/meta/0000_snapshot.json b/apps/web/migrations/meta/0000_snapshot.json
index a4a2ec66..7e502c8b 100644
--- a/apps/web/migrations/meta/0000_snapshot.json
+++ b/apps/web/migrations/meta/0000_snapshot.json
@@ -1,7 +1,7 @@
{
"version": "6",
"dialect": "sqlite",
- "id": "06dbbdd5-8ab1-410a-8710-903d29513644",
+ "id": "e8646bed-105d-4f69-b385-b8b6fee8a6a9",
"prevId": "00000000-0000-0000-0000-000000000000",
"tables": {
"account": {
@@ -518,7 +518,8 @@
"type": "text",
"primaryKey": false,
"notNull": true,
- "autoincrement": false
+ "autoincrement": false,
+ "default": "'none'"
},
"user": {
"name": "user",
@@ -544,6 +545,13 @@
}
},
"indexes": {
+ "space_name_unique": {
+ "name": "space_name_unique",
+ "columns": [
+ "name"
+ ],
+ "isUnique": true
+ },
"spaces_name_idx": {
"name": "spaces_name_idx",
"columns": [
diff --git a/apps/web/migrations/meta/_journal.json b/apps/web/migrations/meta/_journal.json
index df754730..902eabee 100644
--- a/apps/web/migrations/meta/_journal.json
+++ b/apps/web/migrations/meta/_journal.json
@@ -5,8 +5,8 @@
{
"idx": 0,
"version": "6",
- "when": 1721745865475,
- "tag": "0000_stormy_catseye",
+ "when": 1721746132570,
+ "tag": "0000_silky_havok",
"breakpoints": true
}
]
diff --git a/apps/web/server/db/schema.ts b/apps/web/server/db/schema.ts
index 1815c515..ae293a91 100644
--- a/apps/web/server/db/schema.ts
+++ b/apps/web/server/db/schema.ts
@@ -148,7 +148,7 @@ export const space = createTable(
"space",
{
id: integer("id").notNull().primaryKey({ autoIncrement: true }),
- name: text("name").notNull(),
+ name: text("name").notNull().unique().default("none"),
user: text("user", { length: 255 }).references(() => users.id, {
onDelete: "cascade",
}),