juntekim.com/stripe_to_invoice/lib/schema/loginTokens.ts
2025-12-31 00:02:22 +00:00

34 lines
648 B
TypeScript

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