Skip to content

Prisma

Tested with: Prisma 6.16 · PostgreSQL 17 · MySQL 8.4

prisma/schema.prisma
datasource db {
provider = "postgresql"
url = env("DATABASE_URL") // pooled endpoint for the app
directUrl = env("DIRECT_URL") // direct endpoint for migrations
}
.env (never committed)
DATABASE_URL="postgresql://app:<password>@pg-7f3k-pool.us-east.databasezy.com:5432/app?sslmode=verify-full&pgbouncer=true&connection_limit=3"
DIRECT_URL="postgresql://app:<password>@pg-7f3k.us-east.databasezy.com:5432/app?sslmode=verify-full"
  • pgbouncer=true makes Prisma skip prepared-statement caching, which the transaction-mode pooler needs.
  • sslmode=verify-full works with the OS trust store; add &sslcert= only if you use mTLS. To pin the CA file instead, append &sslrootcert=./databasezy-ca.pem.
  • connection_limit bounds the per-process pool; keep it small on serverless.
CI
npx prisma migrate deploy # uses DIRECT_URL
npx prisma generate

On Kubernetes run this as a Job; on Vercel, Netlify, Render and Railway use the platform’s pre-deploy or build step (platform guides).