Problem: npx prisma migrate dev fails with Error P3006 (but database is reachable)
I'm running into an issue with Prisma Migrate and can't find a solution after trying multiple approaches.
---
Initial Setup
I started with an existing PostgreSQL DB (running on Windows Server, not Docker). Here's what I did:
1. Pulled the schema:
2. Created initial migration folder:
3. Generated the SQL migration:
4. Marked migration as applied:
5. Then ran:
---
The Problem
When running
npx prisma migrate dev, I get:
However, the DB is reachable — npx prisma db pull works fine.
---
What I Tried
* Set a valid shadowDatabaseUrl → no change
* Tried migrate resolve --rolled-back and --applied
* Tested with a minimal DB → same error
* Confirmed PostgreSQL user is a superuser
* Not running in Docker → not a container issue
---
Info
* DB: PostgreSQL (Windows Server)
* Backend: NestJS
* Prisma/CLI version: 6.9.0
---
Question
Has anyone faced an issue where prisma migrate dev can't reach the shadow DB, even though db pull works?
Could this be specific to how Prisma handles shadow DBs on non-Docker Windows setups?
Any help appreciated!6 Replies
You're in no rush, so we'll let a dev step in. Enjoy your coffee, or drop into
#ask-ai if you get antsy for a second opinion!Hey!
Can you share your shadowDatabaseUrl connection string?
I assume your shadow database is also running locally. What happens if you try to connect to the shadowdatabase from an IDE like Tableplus, pgAdmin etc. Are you able to connect?
Hi ! Thanks for your answer 🙂
Here is the shadowDatabaseUrl:
postgresql://fakeUser:fakePassword@192.168.1.228:5432/dbhf_shadow?schema=public&connect_timeout=300
And yes I tried to connect using PgAdmin and it worked...
--- UPDATE ---
Here are logs I got in my PosgreSQL server after using the npx prisma migrate dev command:
hey did you find a solution? Have been struggling with exact same problem
Hello !
You can see in the PostgreSQL log file above this error:
2025-06-16 11:11:52 CEST LOG: could not receive data from client: unrecognized winsock error 10054
This is a windows error and here is the explanation according to official documentation:
This means that the issue is not due to prisma but to something else that I didn't find...
I tried to reproduce the same issue on a LinuxOS and a MacOS and it didn't fail so I think it's an OS problem.
I can't dig more on this issue now but but it was all the information that I have so far 🙂I can have the code far away from access ?