Drizzle <> PostgreSQL
This guide assumes familiarity with:
- Database connection basics with Drizzle
- gel-js basics
Drizzle has native support for Gel connections with the gel-js
client.
Step 1 - Install packages
npm
yarn
pnpm
bun
npm i drizzle-orm gel
npm i -D drizzle-kit
Step 2 - Initialize the driver and make a query
gel
gel with config
// Make sure to install the 'gel' package
import { drizzle } from 'drizzle-orm/gel';
const db = drizzle(process.env.DATABASE_URL);
const result = await db.execute('select 1');
If you need to provide your existing driver:
// Make sure to install the 'gel' package
import { drizzle } from "drizzle-orm/gel";
import { createClient } from "gel";
const gelClient = createClient();
const db = drizzle({ client: gelClient });
const result = await db.execute('select 1');