aboutsummaryrefslogtreecommitdiff
path: root/apps/web/migrations
diff options
context:
space:
mode:
authorDhravya Shah <[email protected]>2024-06-18 17:58:46 -0500
committerDhravya Shah <[email protected]>2024-06-18 17:58:46 -0500
commitf4bb71e8f7e07bb2e919b7f222d5acb2905eb8f2 (patch)
tree7310dc521ef3559055bbe71f50c3861be2fa0503 /apps/web/migrations
parentdarkmode by default - so that the colors don't f up on lightmode devices (diff)
parentCreate Embeddings for Canvas (diff)
downloadsupermemory-default-darkmode.tar.xz
supermemory-default-darkmode.zip
Diffstat (limited to 'apps/web/migrations')
-rw-r--r--apps/web/migrations/000_setup.sql55
-rw-r--r--apps/web/migrations/meta/0000_snapshot.json158
-rw-r--r--apps/web/migrations/meta/_journal.json4
3 files changed, 138 insertions, 79 deletions
diff --git a/apps/web/migrations/000_setup.sql b/apps/web/migrations/000_setup.sql
index db7f9444..0c151b98 100644
--- a/apps/web/migrations/000_setup.sql
+++ b/apps/web/migrations/000_setup.sql
@@ -1,18 +1,29 @@
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,
+ `userId` text NOT NULL,
+ `type` text NOT NULL,
+ `provider` text NOT NULL,
+ `providerAccountId` text NOT NULL,
`refresh_token` text,
`access_token` text,
`expires_at` integer,
- `token_type` text(255),
- `scope` text(255),
+ `token_type` text,
+ `scope` text,
`id_token` text,
- `session_state` text(255),
- `oauth_token_secret` text,
- `oauth_token` text,
+ `session_state` text,
+ PRIMARY KEY(`provider`, `providerAccountId`),
+ FOREIGN KEY (`userId`) REFERENCES `user`(`id`) ON UPDATE no action ON DELETE cascade
+);
+--> statement-breakpoint
+CREATE TABLE `authenticator` (
+ `credentialID` text NOT NULL,
+ `userId` text NOT NULL,
+ `providerAccountId` text NOT NULL,
+ `credentialPublicKey` text NOT NULL,
+ `counter` integer NOT NULL,
+ `credentialDeviceType` text NOT NULL,
+ `credentialBackedUp` integer NOT NULL,
+ `transports` text,
+ PRIMARY KEY(`credentialID`, `userId`),
FOREIGN KEY (`userId`) REFERENCES `user`(`id`) ON UPDATE no action ON DELETE cascade
);
--> statement-breakpoint
@@ -25,9 +36,8 @@ CREATE TABLE `contentToSpace` (
);
--> statement-breakpoint
CREATE TABLE `session` (
- `id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
- `sessionToken` text(255) NOT NULL,
- `userId` text(255) NOT NULL,
+ `sessionToken` text PRIMARY KEY NOT NULL,
+ `userId` text NOT NULL,
`expires` integer NOT NULL,
FOREIGN KEY (`userId`) REFERENCES `user`(`id`) ON UPDATE no action ON DELETE cascade
);
@@ -50,27 +60,26 @@ CREATE TABLE `storedContent` (
`ogImage` text(255),
`type` text DEFAULT 'page',
`image` text(255),
- `user` text(255),
+ `user` integer,
FOREIGN KEY (`user`) REFERENCES `user`(`id`) ON UPDATE no action ON DELETE cascade
);
--> 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)
+ `id` text PRIMARY KEY NOT NULL,
+ `name` text,
+ `email` text NOT NULL,
+ `emailVerified` integer,
+ `image` text
);
--> statement-breakpoint
CREATE TABLE `verificationToken` (
- `identifier` text(255) NOT NULL,
- `token` text(255) NOT NULL,
+ `identifier` text NOT NULL,
+ `token` text 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 `authenticator_credentialID_unique` ON `authenticator` (`credentialID`);--> 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
diff --git a/apps/web/migrations/meta/0000_snapshot.json b/apps/web/migrations/meta/0000_snapshot.json
index 29cc4323..20327dda 100644
--- a/apps/web/migrations/meta/0000_snapshot.json
+++ b/apps/web/migrations/meta/0000_snapshot.json
@@ -1,43 +1,36 @@
{
"version": "6",
"dialect": "sqlite",
- "id": "409cec60-0c4b-4cda-8751-3e70768bbb6c",
+ "id": "4a568d9b-a0e6-44ed-946b-694e34b063f3",
"prevId": "00000000-0000-0000-0000-000000000000",
"tables": {
"account": {
"name": "account",
"columns": {
- "id": {
- "name": "id",
- "type": "integer",
- "primaryKey": true,
- "notNull": true,
- "autoincrement": true
- },
"userId": {
"name": "userId",
- "type": "text(255)",
+ "type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"type": {
"name": "type",
- "type": "text(255)",
+ "type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"provider": {
"name": "provider",
- "type": "text(255)",
+ "type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"providerAccountId": {
"name": "providerAccountId",
- "type": "text(255)",
+ "type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
@@ -65,14 +58,14 @@
},
"token_type": {
"name": "token_type",
- "type": "text(255)",
+ "type": "text",
"primaryKey": false,
"notNull": false,
"autoincrement": false
},
"scope": {
"name": "scope",
- "type": "text(255)",
+ "type": "text",
"primaryKey": false,
"notNull": false,
"autoincrement": false
@@ -86,20 +79,86 @@
},
"session_state": {
"name": "session_state",
- "type": "text(255)",
+ "type": "text",
"primaryKey": false,
"notNull": false,
"autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "account_userId_user_id_fk": {
+ "name": "account_userId_user_id_fk",
+ "tableFrom": "account",
+ "tableTo": "user",
+ "columnsFrom": ["userId"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "account_provider_providerAccountId_pk": {
+ "columns": ["provider", "providerAccountId"],
+ "name": "account_provider_providerAccountId_pk"
+ }
+ },
+ "uniqueConstraints": {}
+ },
+ "authenticator": {
+ "name": "authenticator",
+ "columns": {
+ "credentialID": {
+ "name": "credentialID",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
},
- "oauth_token_secret": {
- "name": "oauth_token_secret",
+ "userId": {
+ "name": "userId",
"type": "text",
"primaryKey": false,
- "notNull": false,
+ "notNull": true,
"autoincrement": false
},
- "oauth_token": {
- "name": "oauth_token",
+ "providerAccountId": {
+ "name": "providerAccountId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "credentialPublicKey": {
+ "name": "credentialPublicKey",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "counter": {
+ "name": "counter",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "credentialDeviceType": {
+ "name": "credentialDeviceType",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "credentialBackedUp": {
+ "name": "credentialBackedUp",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "transports": {
+ "name": "transports",
"type": "text",
"primaryKey": false,
"notNull": false,
@@ -107,16 +166,16 @@
}
},
"indexes": {
- "account_userId_idx": {
- "name": "account_userId_idx",
- "columns": ["userId"],
- "isUnique": false
+ "authenticator_credentialID_unique": {
+ "name": "authenticator_credentialID_unique",
+ "columns": ["credentialID"],
+ "isUnique": true
}
},
"foreignKeys": {
- "account_userId_user_id_fk": {
- "name": "account_userId_user_id_fk",
- "tableFrom": "account",
+ "authenticator_userId_user_id_fk": {
+ "name": "authenticator_userId_user_id_fk",
+ "tableFrom": "authenticator",
"tableTo": "user",
"columnsFrom": ["userId"],
"columnsTo": ["id"],
@@ -124,7 +183,12 @@
"onUpdate": "no action"
}
},
- "compositePrimaryKeys": {},
+ "compositePrimaryKeys": {
+ "authenticator_userId_credentialID_pk": {
+ "columns": ["credentialID", "userId"],
+ "name": "authenticator_userId_credentialID_pk"
+ }
+ },
"uniqueConstraints": {}
},
"contentToSpace": {
@@ -177,23 +241,16 @@
"session": {
"name": "session",
"columns": {
- "id": {
- "name": "id",
- "type": "integer",
- "primaryKey": true,
- "notNull": true,
- "autoincrement": true
- },
"sessionToken": {
"name": "sessionToken",
- "type": "text(255)",
- "primaryKey": false,
+ "type": "text",
+ "primaryKey": true,
"notNull": true,
"autoincrement": false
},
"userId": {
"name": "userId",
- "type": "text(255)",
+ "type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
@@ -206,13 +263,7 @@
"autoincrement": false
}
},
- "indexes": {
- "session_userId_idx": {
- "name": "session_userId_idx",
- "columns": ["userId"],
- "isUnique": false
- }
- },
+ "indexes": {},
"foreignKeys": {
"session_userId_user_id_fk": {
"name": "session_userId_user_id_fk",
@@ -360,7 +411,7 @@
},
"user": {
"name": "user",
- "type": "text(255)",
+ "type": "integer",
"primaryKey": false,
"notNull": false,
"autoincrement": false
@@ -407,21 +458,21 @@
"columns": {
"id": {
"name": "id",
- "type": "text(255)",
+ "type": "text",
"primaryKey": true,
"notNull": true,
"autoincrement": false
},
"name": {
"name": "name",
- "type": "text(255)",
+ "type": "text",
"primaryKey": false,
"notNull": false,
"autoincrement": false
},
"email": {
"name": "email",
- "type": "text(255)",
+ "type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
@@ -431,12 +482,11 @@
"type": "integer",
"primaryKey": false,
"notNull": false,
- "autoincrement": false,
- "default": "CURRENT_TIMESTAMP"
+ "autoincrement": false
},
"image": {
"name": "image",
- "type": "text(255)",
+ "type": "text",
"primaryKey": false,
"notNull": false,
"autoincrement": false
@@ -452,14 +502,14 @@
"columns": {
"identifier": {
"name": "identifier",
- "type": "text(255)",
+ "type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"token": {
"name": "token",
- "type": "text(255)",
+ "type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
diff --git a/apps/web/migrations/meta/_journal.json b/apps/web/migrations/meta/_journal.json
index a77d9616..90bb9df7 100644
--- a/apps/web/migrations/meta/_journal.json
+++ b/apps/web/migrations/meta/_journal.json
@@ -5,8 +5,8 @@
{
"idx": 0,
"version": "6",
- "when": 1716677954608,
- "tag": "0000_calm_monster_badoon",
+ "when": 1718412145023,
+ "tag": "0000_absurd_pandemic",
"breakpoints": true
}
]