import postgres from "postgres"; let _sql: ReturnType | null = null; /** Lazily-created shared postgres.js connection pool. */ export function getSql() { if (!_sql) { const url = process.env.DATABASE_URL; if (!url) throw new Error("DATABASE_URL not set"); _sql = postgres(url, { max: 5, idle_timeout: 30 }); } return _sql; }