CipherStashDocs
IntegrationsPrisma ORM

Prisma Postgres

Connect the CipherStash Prisma ORM 8 integration to Prisma's managed Postgres service.

Prisma Postgres is Prisma's managed Postgres service. CipherStash uses it like any other Postgres database: encryption happens in the application, and EQL plus the encrypted domains live in the database.

Choose the connection URL

Prisma Postgres provides pooled and direct connections:

UseConnection
Application runtimePooled URL on pooled.db.prisma.io
Migrations, administrative work, and one-off backfillsDirect URL on db.prisma.io

Both connections require TLS. Copy the URLs from the Prisma Console and keep them in the relevant environment's secret store.

.env
DATABASE_URL=postgresql://[email protected]:5432/postgres?sslmode=require
DIRECT_URL=postgresql://[email protected]:5432/postgres?sslmode=require

Use the direct URL when applying the Prisma migration graph or running a long-lived backfill. Use the pooled URL when connecting the deployed application.

Initialize the database

Set the migration process to the direct connection, then run the normal Prisma flow:

DATABASE_URL="$DIRECT_URL" npx prisma-next contract emit
DATABASE_URL="$DIRECT_URL" npx prisma-next migration plan --name initial
DATABASE_URL="$DIRECT_URL" npx prisma-next migrate

This installs EQL through Prisma's migration graph. Do not install EQL separately with the stash CLI.

For a populated column, use the direct connection for the out-of-band backfill and confirm that it targets the intended production or preview database. Follow the Prisma deployment guide before changing live data.

What appears in Prisma tools

Prisma Studio and the Prisma Console see EQL ciphertext payloads, not plaintext. That is expected: encryption keys remain in the application, outside Prisma Postgres. Read and update encrypted values through the CipherStash-enabled Prisma runtime.

Branch databases

Prisma platform branches can have isolated databases. Treat each branch as a separate CipherStash environment:

  • Confirm the database identity before migrations or backfills.
  • Use separate CS_* credentials for preview and production.
  • Keep every writer and one-off job on the keyset intended for that environment.

If the application is also hosted by Prisma, Prisma Compute explains its build, environment-variable, and migration behavior.

On this page