Prisma Postgres는 서버리스 드라이버도 제공하며, 향후 Drizzle ORM에서 지원될 예정입니다.
Drizzle <> Prisma Postgres
This guide assumes familiarity with:
Prisma Postgres는 unikernels 기반으로 구축된 서버리스 데이터베이스입니다. 넉넉한 무료 티어, 작업 기반 요금제, 그리고 콜드 스타트가 없는 것이 특징입니다.
PostgreSQL용 node-postgres 또는 postgres.js 드라이버를 사용하여 연결할 수 있습니다.
Step 1 - 패키지 설치
node-postgres (pg)
postgres.js
npm
yarn
pnpm
bun
npm i drizzle-orm pg
npm i -D drizzle-kit
Step 2 - 드라이버 초기화 및 쿼리 실행
node-postgres (pg)
postgres.js
// Make sure to install the 'pg' package
import { drizzle } from "drizzle-orm/node-postgres";
import { Pool } from "pg";
const pool = new Pool({
connectionString: process.env.DATABASE_URL,
});
const db = drizzle({ client: pool });
const result = await db.execute('select 1');