Files
editor/packages/db/src/drizzle.ts
T
Aymeric RabotandClaude Opus 4.6 a0ac904dfc fix: lazy-init Supabase and Drizzle clients for build compatibility
Defer database client creation until first use via Proxy so Next.js
builds succeed without POSTGRES_URL and SUPABASE_URL env vars present.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-02-19 01:21:41 -05:00

12 lines
318 B
TypeScript

import { drizzle } from 'drizzle-orm/postgres-js'
import postgres from 'postgres'
import * as schema from './schema'
const connectionString = process.env.POSTGRES_URL ?? ''
const client = postgres(connectionString, { prepare: false })
export const db = drizzle({ client, schema })
export type Database = typeof db