Files
agentic-coding-starter-kit/src/lib/schema.ts
Leon van Zyl c412e6e76d Init
2025-08-11 12:38:39 +02:00

47 lines
1.6 KiB
TypeScript

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(),
})