File
Blob: src/worker/db/d1/schema/users.ts
| 1 | import { integer, sqliteTable, text } from "drizzle-orm/sqlite-core"; |
| 2 | |
| 3 | // Global user identity. `tessera_sub` is the verified `sub` claim from |
| 4 | // tessera; it is opaque, stable, and is the only thing we trust as identity. |
| 5 | // `preferred_username` from the ID token is treated as a slug candidate at |
| 6 | // signup and is not stored here. |
| 7 | export const users = sqliteTable("users", { |
| 8 | id: text("id").primaryKey(), |
| 9 | tesseraSub: text("tessera_sub").notNull().unique(), |
| 10 | createdAt: integer("created_at").notNull(), |
| 11 | }); |
| 12 | |
| 13 | export type UserRow = typeof users.$inferSelect; |
| 14 | export type NewUserRow = typeof users.$inferInsert; |