User Table
Core user account information with JSONB settings for flexible configuration.Schema Definition
Primary key - unique user identifier
User’s display name
User’s email address (unique constraint)
Whether the email address has been verified
URL to user’s profile image (optional)
Account creation timestamp
Last update timestamp (auto-updates on modification)
Relationships
- Has many
sessionrecords (cascade delete) - Has many
accountrecords (cascade delete) - Has many
todorecords (cascade delete) - Has many
studySetrecords (cascade delete)
Session Table
Manages user authentication sessions with expiration and tracking.Schema Definition
Primary key - unique session identifier
Session expiration timestamp
Session token (unique constraint)
Session creation timestamp
Last update timestamp (auto-updates on modification)
IP address from which session was created (optional)
Browser/client user agent string (optional)
Foreign key to
user.id (cascade delete)Relationships
- Belongs to
user(cascade delete when user is removed)
Account Table
Stores OAuth provider credentials and authentication tokens.Schema Definition
Primary key - unique account identifier
Provider’s account identifier
OAuth provider identifier (e.g., “google”, “github”)
Foreign key to
user.id (cascade delete)OAuth access token (optional)
OAuth refresh token (optional)
OAuth ID token (optional)
Access token expiration timestamp (optional)
Refresh token expiration timestamp (optional)
OAuth scope string (optional)
Hashed password for credential-based auth (optional)
Account creation timestamp
Last update timestamp (auto-updates on modification)
Relationships
- Belongs to
user(cascade delete when user is removed)
Verification Table
Manages email verification tokens and other verification processes.Schema Definition
Primary key - unique verification identifier
Identifier to verify (e.g., email address)
Verification token value
Verification token expiration timestamp
Verification creation timestamp
Last update timestamp (auto-updates on modification)
Usage
Verification records are typically short-lived and used for:- Email verification during registration
- Password reset tokens
- Two-factor authentication codes
Database Configuration
Source:apps/web/src/db/schema/auth.ts
All foreign keys use { onDelete: "cascade" } to automatically remove dependent records when a user is deleted.