Database¶
Schema, migrations, RLS policies, and data management.
Guides¶
Database Setup¶
Complete schema reference:
- Table structure and relationships
- Postgres stored functions (
get_current_snapshot_id,set_current_snapshot, etc.) - Row Level Security (RLS) policies
- Indexes and performance considerations
Data Hydration and Seeding¶
Comprehensive data strategy reference covering all three layers:
- Layer 1: Migrations (schema + minimal seed rows)
- Layer 2: Content seed scripts (curriculum and catalog data)
- Layer 3: Test user / auth seed (local only)
- Environment profiles (local, staging, production)
- All
deno taskcommands for data management
Seed Curriculum Guide¶
Agentic AI curriculum seed data (the built-in sample dataset):
- 1 domain · 3 trails · 12 concepts · 18 sparks · 20+ prerequisite links
- Seed data format
- Import process
Snapshot Publishing Workflow¶
Content versioning lifecycle:
is_published(per-entity visibility control)snapshot.status(batch version control: draft → published → archived)- How both mechanisms work together
- Historical queries using
?snapshot_id=uuid
Content Model¶
Domain (e.g., "Machine Learning")
└── Trail (10-20 hours, e.g., "Transformer Mastery")
└── Concept (30-60 mins, e.g., "Attention Mechanisms")
└── Spark (5-10 mins, e.g., "Self-Attention Explained")
Sparks are connected by prerequisite links forming a DAG (knowledge graph). All entities belong to a snapshot enabling versioned queries.
Database Commands¶
# Reset local database (applies all migrations + seed data)
supabase db reset
# Create new migration
supabase migration new <name>
# Push migrations to remote
supabase db push
# Push to specific branch (staging)
supabase db push --branch develop
# Check migration status
deno task db:status
Related Documentation¶
- Data Hydration and Seeding — All seeding tasks
- Deployment Guide — Database deployment
- Integration Testing — Test data seeding