Overview
Estudio Three uses Supabase (PostgreSQL 15+) as its primary database with a comprehensive relational schema designed for multi-dimensional student-athlete data management.Entity Relationship Diagram
Custom Enums
PostgreSQL enums ensure type safety and data integrity:Core Tables
profiles
Extends Supabase Auth users with application-specific data.sport_info: Stores sport-specific data (team, position, training intensity)preferences: UI preferences, notification settings, default viewshas_onboarded: Tracks if user completed initial setup
subjects
Academic subjects with difficulty ratings (1-5).- 1: Very Easy
- 2: Easy
- 3: Moderate
- 4: Hard
- 5: Very Hard (used by routine solver to prioritize study time)
tasks
Powerful task management with Pomodoro tracking and recurrence.subtasks
Checkbox-style subtasks for breaking down complex tasks.events
Calendar events (exams, matches, appointments).weekly_schedule
Recurring weekly commitments (classes, training sessions).0 = Sunday, 1 = Monday, ..., 6 = Saturday
Routine Engine Tables
routines
Daily routine container with load metrics.routine_blocks
Individual time blocks within a routine.FIXED: Cannot be moved (school, training, sleep)FLEXIBLE: Can be rescheduled by solverBUFFER: Short breaks inserted by solver
Focus and Productivity
focus_sessions
Pomodoro timer history.daily_feedback
User-reported daily metrics.Academic Tracking
grades
Grade tracking with weighted scores.academic_periods
Semesters, trimesters, or school years.resources
Study materials linked to subjects.Gamification
habits
Daily habit tracking with streak calculation.habit_logs
Daily habit completion records.achievements
System-defined achievements (not user-specific).user_achievements
Tracks which achievements users have unlocked.AI and Chat
chat_history
Stores AI coach conversation history.Goals
goals
Long-term objectives with progress tracking.Row Level Security (RLS)
All tables have RLS enabled with strict user isolation policies.Example Policies
profiles - Public Read, Self-Update
profiles - Public Read, Self-Update
tasks - Private Access Only
tasks - Private Access Only
subtasks - Cascading RLS
subtasks - Cascading RLS