The database is not just there for auth. It stores chats, generations,
purchases, credits, recordings, documents, embeddings, and more.
How Database Changes Are Managed
Schema changes live in:supabase/migrations/*
Main Table Families
Profiles
Created from:20240000000001_profiles.sql
- store user profile data
- track credits
- connect app users to
auth.users
Generations
Created from:20240000000002_generations.sql
- store outputs from AI apps
- keep input/output payloads
- support reusable generation history across multiple apps
Chat
Created from:20240000000003_chat.sql
- chats
- messages
- chat document versioning
PDF And RAG
Created and extended from:20240000000005_pdf.sql20260305000009_chat_pdf_unification.sql
- uploaded PDFs
- embeddings
- document-to-chat links
- similarity search functions
Audio Notes
Created from:20240000000006_voice_to_notes.sql
- recordings
- transcripts
- summaries
Purchases
Created and extended from:20240000000007_purchases.sql- later payment normalization and uniqueness migrations
- purchase records
- provider metadata
- credit packs and plan purchases
Important Database Behaviors
Row Level Security
Most user-owned tables use RLS so users only access their own data.Credits
Credit logic is not just a frontend number. The repo includes database-assisted credit mutation flows to reduce race conditions.Vector search
The PDF system usespgvector plus retrieval functions so the chat app can do
document-aware answers with citations.
Why This Matters
If you are customizing the product, understanding the table families helps you avoid a common mistake: trying to bolt new features onto random existing tables instead of using the repo’s actual data model.Good First Files To Read
supabase/migrations/20240000000001_profiles.sqlsupabase/migrations/20240000000002_generations.sqlsupabase/migrations/20240000000003_chat.sqlsupabase/migrations/20240000000005_pdf.sqlsupabase/migrations/20240000000006_voice_to_notes.sqlsupabase/migrations/20240000000007_purchases.sql

