From d8ff5f4bb1bd0054799406ca82812fd4bf3f2349 Mon Sep 17 00:00:00 2001 From: Christopher Mayor Date: Fri, 24 Apr 2026 14:33:37 -0700 Subject: [PATCH] feat: add users and sessions tables for Better Auth --- src/lib/db/schema.ts | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/lib/db/schema.ts b/src/lib/db/schema.ts index 7335881..33407e4 100644 --- a/src/lib/db/schema.ts +++ b/src/lib/db/schema.ts @@ -9,6 +9,27 @@ import { index, } from "drizzle-orm/pg-core"; +export const users = pgTable("users", { + id: text("id").primaryKey(), + name: text("name"), + email: text("email").notNull().unique(), + emailVerified: boolean("email_verified").default(false), + image: text("image"), + createdAt: timestamp("created_at").defaultNow().notNull(), + updatedAt: timestamp("updated_at").defaultNow().notNull(), +}); + +export const sessions = pgTable("sessions", { + id: text("id").primaryKey(), + userId: text("user_id") + .notNull() + .references(() => users.id, { onDelete: "cascade" }), + token: text("token").notNull().unique(), + expiresAt: timestamp("expires_at").notNull(), + createdAt: timestamp("created_at").defaultNow().notNull(), + updatedAt: timestamp("updated_at").defaultNow().notNull(), +}); + export const comparisons = pgTable( "comparisons", {