This commit is contained in:
Leon van Zyl
2025-08-11 12:38:39 +02:00
parent 2af182a3a8
commit c412e6e76d
21 changed files with 7522 additions and 120 deletions

47
src/lib/schema.ts Normal file
View File

@@ -0,0 +1,47 @@
import { pgTable, text, timestamp, boolean, primaryKey } from "drizzle-orm/pg-core"
export const user = pgTable("user", {
id: text("id").primaryKey(),
name: text("name"),
email: text("email").unique(),
emailVerified: boolean("emailVerified"),
image: text("image"),
createdAt: timestamp("createdAt").defaultNow(),
updatedAt: timestamp("updatedAt").defaultNow(),
})
export const session = pgTable("session", {
id: text("id").primaryKey(),
expiresAt: timestamp("expiresAt"),
token: text("token").unique(),
createdAt: timestamp("createdAt").defaultNow(),
updatedAt: timestamp("updatedAt").defaultNow(),
ipAddress: text("ipAddress"),
userAgent: text("userAgent"),
userId: text("userId").references(() => user.id, { onDelete: "cascade" }),
})
export const account = pgTable("account", {
id: text("id").primaryKey(),
accountId: text("accountId"),
providerId: text("providerId"),
userId: text("userId").references(() => user.id, { onDelete: "cascade" }),
accessToken: text("accessToken"),
refreshToken: text("refreshToken"),
idToken: text("idToken"),
accessTokenExpiresAt: timestamp("accessTokenExpiresAt"),
refreshTokenExpiresAt: timestamp("refreshTokenExpiresAt"),
scope: text("scope"),
password: text("password"),
createdAt: timestamp("createdAt").defaultNow(),
updatedAt: timestamp("updatedAt").defaultNow(),
})
export const verification = pgTable("verification", {
id: text("id").primaryKey(),
identifier: text("identifier"),
value: text("value"),
expiresAt: timestamp("expiresAt"),
createdAt: timestamp("createdAt").defaultNow(),
updatedAt: timestamp("updatedAt").defaultNow(),
})