Problem
When using Prisma with cloud-hosted databases (Prisma Postgres, Neon, Supabase, etc.), prisma migrate dev fails with shadow database errors like:
Error: P3006 Migration 20251005080724_init failed to apply cleanly to the shadow database. Error: type "ParentageRole" already exists
This happens because Prisma tries to use the same database for both:
- The application's main database
- The shadow database (used for migration validation)
Current Documentation Gap
The official migration docs mention shadow databases, but:
- ❌ No clear guidance for cloud database providers
- ❌ No step-by-step setup for Prisma Postgres specifically
- ❌ Error messages don't point users to the solution
- ❌ Many users resort to
migrate resetthinking migrations are broken
Solution (that should be documented)
Create a separate shadow db.
For Vercel Integration of Prisma Postgres,
-
Go to Projects->Storage->Create Database-> Select Prisma Postgres-> Select region->Create->Add "SHADOW" as environment variable prefix.
-
Do a
vercel env pull -
Set
shadowDatabaseUrlinschema.prismatoSHADOW_DATABASE_URL