Step-by-step guide for creating and deploying database migrations
Set up your environment
Create a feature branch
Generate migration file
supabase/migrations/
:Write your migration
Test locally
Commit and push
Create pull request
dev
branch triggers deploymentsupabase db push
after switching to devdev
to main
branchIF NOT EXISTS
, IF EXISTS
, and proper checkssupabase db reset
before pushingMigration fails with 'already exists' error
IF NOT EXISTS
checks:RLS policies blocking access
Migration works locally but fails in CI
IF EXISTS
checksNeed to modify a migration