Shipflash logoDocs

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

PathUse
supabase/migrationsSchema history and permanent database changes.
src/lib/supabase/types.tsGenerated database type surface.
scripts/contract-supabase-types.mjsValidation and generation wrapper for Supabase types.