Skip to content
File

Blob: src/worker/db/d1/schema/users.ts

typescript15 lines
1import { 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.
7export const users = sqliteTable("users", {
8 id: text("id").primaryKey(),
9 tesseraSub: text("tessera_sub").notNull().unique(),
10 createdAt: integer("created_at").notNull(),
11});
12 
13export type UserRow = typeof users.$inferSelect;
14export type NewUserRow = typeof users.$inferInsert;