Understand the database schema and migration structure
mainThe migrations/ directory contains SQL scripts for application-specific tables.
Key Migration Files
001_create_app_schema.sql: Creates core application tables includingconversations,messages, anduser profiles.
Schema Relationships and Constraints
- Better Auth Integration: The application relies on
Better Authfor authentication.Better Authmanages its own tables (user,session,account,verification) automatically. - Foreign Keys: Application tables reference the
Better Authuser table using auser_idfield of typetext. - Idempotency: All migration scripts use
IF NOT EXISTSto ensure they can be run multiple times without error.