aboutsummaryrefslogtreecommitdiff
path: root/apps/web/server
diff options
context:
space:
mode:
authorDhravya <[email protected]>2024-06-23 17:24:10 -0500
committerDhravya <[email protected]>2024-06-23 17:24:10 -0500
commit9df975e88f3ebbed5a9f064b98e67c91f21cd39a (patch)
tree8e813ec001ce2bc5c4a61c8bfa79e73ef1615dc1 /apps/web/server
parentMerge pull request #79 from Dhravya/chathistory (diff)
downloadsupermemory-9df975e88f3ebbed5a9f064b98e67c91f21cd39a.tar.xz
supermemory-9df975e88f3ebbed5a9f064b98e67c91f21cd39a.zip
added indexes and stuff
Diffstat (limited to 'apps/web/server')
-rw-r--r--apps/web/server/db/schema.ts27
1 files changed, 18 insertions, 9 deletions
diff --git a/apps/web/server/db/schema.ts b/apps/web/server/db/schema.ts
index f54d2094..69372a35 100644
--- a/apps/web/server/db/schema.ts
+++ b/apps/web/server/db/schema.ts
@@ -11,15 +11,24 @@ import type { AdapterAccountType } from "next-auth/adapters";
export const createTable = sqliteTableCreator((name) => `${name}`);
-export const users = createTable("user", {
- id: text("id")
- .primaryKey()
- .$defaultFn(() => crypto.randomUUID()),
- name: text("name"),
- email: text("email").notNull(),
- emailVerified: integer("emailVerified", { mode: "timestamp_ms" }),
- image: text("image"),
-});
+export const users = createTable(
+ "user",
+ {
+ id: text("id")
+ .primaryKey()
+ .$defaultFn(() => crypto.randomUUID()),
+ name: text("name"),
+ email: text("email").notNull(),
+ emailVerified: integer("emailVerified", { mode: "timestamp_ms" }),
+ image: text("image"),
+ telegramId: text("telegramId"),
+ },
+ (user) => ({
+ emailIdx: index("users_email_idx").on(user.email),
+ telegramIdx: index("users_telegram_idx").on(user.telegramId),
+ idIdx: index("users_id_idx").on(user.id),
+ }),
+);
export type User = typeof users.$inferSelect;