backend/src/database/schema/.
Schema Architecture Diagram
Core Schema Tables
1. users
Primary user table handling authentication credentials, notification preferences, and GitHub account linking.
2. sessions
Tracks active device and browser sessions. Mirrored in Redis (session:<id>) with a 30-day TTL.
3. otpVerification
Storage table for time-sensitive OTP verification payloads for signup and password reset.
4. workspace_settings
Per-user AI model configurations and custom mode prompts.
5. byok
Encrypted third-party API keys and custom model endpoints.
6. pull_requests
Stores ingested GitHub pull request metadata, diff URLs, and sync statuses.
7. review
Automated AI review outcomes, raw structured findings JSON, and operational execution metadata.
8. ai_conversation & ai_messages
Thread containers and individual messages for PR-linked AI conversations.
ai_conversation
ai_messages
9. usage
Cumulative spend tracking per user against the complimentary $0.30 platform threshold.