.sql files you can inspect.
For pooler-level constraints, see Connection pooling. For broader migration patterns, see Migrations.
Connection setup
Drizzle works with several Postgres drivers. The most-used pairing on Powabase ispostgres.js (a.k.a. postgres). One required flag on the URL:
prepare=false— disablespostgres.js’s prepared-statement cache. Required for PgBouncer transaction-mode pooling.
{ prepare: false } directly in client options instead of the query param:
Schema as TypeScript
src/schema.ts:
Queries
db.select().from().where().orderBy().limit() maps 1:1 to SELECT ... FROM ... WHERE ... ORDER BY ... LIMIT. The advantage over raw SQL is that Drizzle infers result types from the schema; the advantage over heavier ORMs is that there’s no magic between you and the query plan.
Migrations with Drizzle Kit
drizzle.config.ts:
./drizzle/ as .sql files (one per migration step) plus a _journal.json index. Inspect them before applying in production — Drizzle’s generated SQL is straightforward but worth a glance for anything that touches data.
The migration tracking table is drizzle.__drizzle_migrations. Don’t touch it.
RLS with Drizzle
Drizzle, like Prisma, connects assupabase_admin and bypasses RLS. To run a query under a specific user’s identity for RLS-gated reads:
/rest/v1/*) under user JWTs for RLS-required reads from the browser, Drizzle for server-side work under supabase_admin.
Drizzle in serverless
postgres.js opens a real socket per call. In Lambda / Vercel Functions, the right shape is one connection per invocation:
max: 1 keeps each invocation to one connection. Without sql.end(), you’ll leak connections at PgBouncer until max_client_conn = 200 cluster-wide runs out and new invocations start 429ing.
For high-traffic serverless workloads, consider Drizzle’s HTTP-based drivers (Neon serverless driver, Vercel Postgres) — they’re built for stateless invocations and don’t burn pooler slots. But for moderate serverless traffic on Powabase, the open-and-close pattern is fine.
Next steps
Connection pooling
Why
prepare=false is required.Migrations
The migration patterns across all three ORMs we cover.
Direct Postgres
For SQL Drizzle doesn’t cover — bulk imports, schema introspection.
Prisma
The heavier-but-more-batteries-included TypeScript alternative.