Auth
Users, organizations, sessions, and invitations.
Source: packages/db/src/schema/auth.ts
Enums
| Enum | Values |
|---|---|
organization_status | active, suspended, deleted |
user
Core user accounts.
| Column | Type | Notes |
|---|---|---|
id | text | PK |
name | text | NOT NULL |
email | text | NOT NULL, UNIQUE |
email_verified | boolean | default false |
image | text | |
created_at | timestamp | |
updated_at | timestamp | |
role | text | |
banned | boolean | default false |
ban_reason | text | |
ban_expires | timestamp | |
active_organization_id | text | |
mode | text | default dev |
account
OAuth and credential provider links.
| Column | Type | Notes |
|---|---|---|
id | text | PK |
account_id | text | NOT NULL |
provider_id | text | NOT NULL |
user_id | text | FK → user.id, CASCADE |
access_token | text | |
refresh_token | text | |
id_token | text | |
access_token_expires_at | timestamp | |
refresh_token_expires_at | timestamp | |
scope | text | |
password | text | |
created_at | timestamp | |
updated_at | timestamp |
verification
OTP and email verification tokens.
| Column | Type | Notes |
|---|---|---|
id | text | PK |
identifier | text | NOT NULL, indexed |
value | text | NOT NULL |
expires_at | timestamp | NOT NULL |
created_at | timestamp | |
updated_at | timestamp |
jwks
JSON Web Key Set storage for token signing.
| Column | Type | Notes |
|---|---|---|
id | text | PK |
public_key | text | NOT NULL |
private_key | text | NOT NULL |
created_at | timestamp | NOT NULL |
expires_at | timestamp |
organization
Workspaces / tenants.
| Column | Type | Notes |
|---|---|---|
id | text | PK |
name | text | NOT NULL |
slug | text | NOT NULL, UNIQUE |
logo | text | |
created_at | timestamp | NOT NULL |
metadata | text | |
billing_email | text | |
billing_name | text | |
external_customer_id | text | UNIQUE |
status | organization_status | default active |
member
User ↔ organization membership.
| Column | Type | Notes |
|---|---|---|
id | text | PK |
organization_id | text | FK → organization.id, CASCADE |
user_id | text | FK → user.id, CASCADE |
role | text | default member |
created_at | timestamp | NOT NULL |
invitation
Pending organization invites.
| Column | Type | Notes |
|---|---|---|
id | text | PK |
organization_id | text | FK → organization.id, CASCADE |
email | text | NOT NULL |
role | text | |
status | text | default pending |
expires_at | timestamp | NOT NULL |
created_at | timestamp | |
inviter_id | text | FK → user.id, CASCADE |
Was this page helpful?