Security News
38% of CISOs Fear They’re Not Moving Fast Enough on AI
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
@prisma/adapter-pg-worker
Advanced tools
Prisma's driver adapter for "@prisma/pg-worker"
This package provides a driver adapter for Prisma ORM that allows you to use the @prisma/pg-worker
package as a connection pool for PostgreSQL databases.
@prisma/pg-worker
is a lightweight version of pg
that is designed to be used in a worker. It is a drop-in replacement for pg
and is fully compatible with Prisma ORM.
This section explains how you can use it with Prisma ORM and the @prisma/adapter-pg-worker
driver adapter. Be sure that the DATABASE_URL
environment variable is set to your PostgreSQL connection string (e.g. in a .env
file).
driverAdapters
Preview feature flagSince driver adapters are currently in Preview, you need to enable its feature flag on the datasource
block in your Prisma schema:
// schema.prisma
generator client {
provider = "prisma-client-js"
previewFeatures = ["driverAdapters"]
}
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
Once you have added the feature flag to your schema, re-generate Prisma Client:
npx prisma generate
Next, install the @prisma/pg-worker
package and Prisma ORM's driver adapter:
npm install @prisma/pg-worker
npm install @prisma/adapter-pg-worker
Finally, when you instantiate Prisma Client, you need to pass an instance of Prisma ORM's driver adapter to the PrismaClient
constructor:
import { Pool } from '@prisma/pg-worker'
import { PrismaPg } from '@prisma/adapter-pg-worker'
import { PrismaClient } from '@prisma/client'
const connectionString = `${process.env.DATABASE_URL}`
const pool = new Pool({ connectionString })
const adapter = new PrismaPg(pool)
const prisma = new PrismaClient({ adapter })
We encourage you to create an issue if you find something missing or run into a bug.
If you have any feedback, leave a comment in this GitHub discussion.
FAQs
Prisma's driver adapter for "@prisma/pg-worker"
The npm package @prisma/adapter-pg-worker receives a total of 367 weekly downloads. As such, @prisma/adapter-pg-worker popularity was classified as not popular.
We found that @prisma/adapter-pg-worker demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.
Security News
Company News
Socket is joining TC54 to help develop standards for software supply chain security, contributing to the evolution of SBOMs, CycloneDX, and Package URL specifications.