When using Prisma with cloud-hosted databases (Prisma Postgres, Neon, Supabase, etc.),
prisma migrate dev
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: 1. The application's main database 2. The shadow database (used for migration validation)
- 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 reset
migrate reset
thinking migrations are broken
Solution (that should be documented)
Create a separate shadow db.
For Vercel Integration of Prisma Postgres, 1. Go to Projects->Storage->Create Database-> Select Prisma Postgres-> Select region->Create->Add "SHADOW" as environment variable prefix. 2. Do a