@vertexa/prisma-adapter-pg
v7.9.1
Published
Fork of @prisma/adapter-pg — PostgreSQL driver adapter for Prisma ORM with PostGIS OID detection. Automatically converts geometry/geography columns to GeoJSON objects.
Maintainers
Readme
@vertexa/prisma-adapter-pg
Fork of @vertexa/prisma-adapter-pg with PostGIS OID detection.
Driver adapter for Prisma ORM that enables usage of the node-postgres (pg) database driver for PostgreSQL — same as upstream, plus automatic detection of PostGIS geometry / geography column OIDs so they are returned as typed GeoJSON objects instead of raw bytes.
Install
npm install @vertexa/prisma-adapter-pgUsage
import { PrismaPg } from '@vertexa/prisma-adapter-pg'
import { PrismaClient } from '@vertexa/prisma-client'
import { Pool } from 'pg'
const adapter = new PrismaPg(new Pool({ connectionString: process.env.DATABASE_URL }))
const prisma = new PrismaClient({ adapter })What's different from upstream?
The fork patches the adapter to recognize PostGIS OIDs (geometry, geography) and decode the EWKB bytes returned by pg into GeoJSON objects that Prisma Client can work with directly. Without this, PostGIS columns come back as opaque Buffer values.
This adapter is required for PostGIS features (near, within, intersects, distanceFrom) to work with @vertexa/prisma-client.
License
Apache-2.0
