Database Migrations
Migrations live in supabase/migrations and define durable schema, constraints, indexes, and data contracts.
On this page
Migration rules
- Keep permanent schema changes in migrations.
- Keep one-off repair SQL separate from baseline schema work.
- Regenerate affected Supabase types after schema changes.
- Run pnpm run contract:migrations after touching migration files.
- Never reset a linked production database.
Useful paths
| Path | Use |
|---|---|
| supabase/migrations | Schema history and permanent database changes. |
| src/lib/supabase/types.ts | Generated database type surface. |
| scripts/contract-supabase-types.mjs | Validation and generation wrapper for Supabase types. |