Using PgBouncer with Prisma

If I enable Connection Pooling will I still be able to connect directly to Postgres, without using PgBouncer, to run Prisma migrations which don’t work through PgBouncer? Meaning, will I have two different connection strings I can use, one for just Postgres, and one for PgBouncer?

That’s exactly what I do. So I have two environment variables:

// The pgBouncer connection string
DATABASE_URL=""

// The direct postgres connection string
MIGRATE_DATABASE_URL=""

My prisma schema connects to the pgBouncer instance using the env("DATABASE_URL") value, and then in my deployment script, I just have the following script in package.json:

"prisma:migrate": "DATABASE_URL=\"$MIGRATE_DATABASE_URL\" prisma migrate deploy",

This workflow has been working great for me. Hope this helps.

Hey Chris,

Was Drew’s post above able to help?

Jérémy, Render Support

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.