// lib/schema/loginTokens.ts import { pgTable, uuid, text, timestamp, } from "drizzle-orm/pg-core"; import { users } from "./users"; export const loginTokens = pgTable("login_tokens", { id: uuid("id").primaryKey().defaultRandom(), userId: uuid("user_id") .notNull() .references(() => users.id, { onDelete: "cascade", }), tokenHash: text("token_hash").notNull(), expiresAt: timestamp("expires_at", { withTimezone: true, }).notNull(), usedAt: timestamp("used_at", { withTimezone: true, }), createdAt: timestamp("created_at", { withTimezone: true, }) .notNull() .defaultNow(), });