DEV Community

Cover image for Prisma migration stuck?
Abdullah Bashir
Abdullah Bashir

Posted on

Prisma migration stuck?

I was trying to npx prisma migrate dev --name init to a supabase Postgre db. It was stuck here for way too long. Just after getting off of Prisma's Error P1001

Stuck Migration

npx prisma migrate dev --name init
Environment variables loaded from .env
Prisma schema loaded from prisma\schema.prisma
Datasource "db": PostgreSQL database "postgres", schema "public" at "aws-0-us-west-1.pooler.supabase.com:5432"
Enter fullscreen mode Exit fullscreen mode

Prisma migration to Supabase got stuck here for a suspiciously long time.

Fix: Change your ports from 6543 to 5432 in your DATABASE_URL and your DIRECT_URL (DIRECT_URL is necessary for migration). Stackoverflow solution here.

Before:
DATABASE_URL=postgres://[db-user].[project-ref]:[db-password]@aws-0-[aws-region].pooler.supabase.com:6543/[db-name]?pgbouncer=true&connection_limit=1
DIRECT_URL=postgres://[db-user].[project-ref]:[db-password]@aws-0-[aws-region].pooler.supabase.com:6543/[db-name]


Now:
DATABASE_URL=postgres://[db-user].[project-ref]:[db-password]@aws-0-[aws-region].pooler.supabase.com:5432/[db-name]?pgbouncer=true&connection_limit=1
DIRECT_URL=postgres://[db-user].[project-ref]:[db-password]@aws-0-[aws-region].pooler.supabase.com:5432/[db-name]
Enter fullscreen mode Exit fullscreen mode

Results:

Working Migration

Happy Hacking!

Top comments (2)

Collapse
 
bmitchinson profile image
Ben Mitchinson

Woah, that totally fixed it, thanks !

Collapse
 
digitaldrreamer profile image
Abdullah Bashir

I'm glad I helped :)