This package contains the driver adapter for Prisma ORM that enables usage of the node-postgres (pg) database driver for PostgreSQL. You can learn more in the documentation.
pg is one of the most popular drivers in the JavaScript ecosystem for PostgreSQL databases. It can be used with any PostgreSQL database that's accessed via TCP.
Note:: Support for the
pgdriver is available from Prisma versions 5.4.2 and later.
This section explains how you can use it with Prisma ORM and the @prisma/adapter-pg driver adapter. Be sure that the DATABASE_URL environment variable is set to your PostgreSQL connection string (e.g. loaded using dotenv from a .env file).
Install the Prisma ORM's driver adapter for pg:
npm install @prisma/adapter-pg
Finally, when you instantiate Prisma Client, you need to pass an instance of Prisma ORM's driver adapter to the PrismaClient constructor:
import { PrismaPg } from '@prisma/adapter-pg'
import { PrismaClient } from '@prisma/client'
const connectionString = `${process.env.DATABASE_URL}`
const adapter = new PrismaPg({ connectionString })
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.