Digital Dreamer
Writing /
Read on dev.to

Prisma migration stuck?

I was trying to npx prisma migrate dev --name init to a supabase Postgre db. It was stuck. Here's how to fix it.

Prisma migration stuck?

I was trying to npx prisma migrate dev --name init to a supabase Postgre db. It was stuck for a long time.

The solution is similar to the db push/pull issue: you need to use a direct connection string for migrations.

text
# Ensure your DIRECT_URL uses port 5432
DIRECT_URL="postgresql://...@db.supabase.co:5432/db"

And in your schema.prisma:

prisma
datasource db {
  provider  = "postgresql"
  url       = env("DATABASE_URL")
  directUrl = env("DIRECT_URL")
}

This fixed it for me and many others in the community!

Happy Hacking!