P
Prisma2mo ago
hanifb

Prisma migrate dev shadow database error

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: 1. The application's main database 2. 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 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 vercel env pull 3. Set shadowDatabaseUrl in schema.prisma to SHADOW_DATABASE_URL
2 Replies
Prisma AI Help
Prisma AI Help2mo ago
You selected to wait for the human sages. They'll share their wisdom soon. Grab some tea while you wait, or check out #ask-ai if you'd like a quick chat with the bot anyway!

Did you find this page helpful?