/** * node-postgres reads `sslmode=require` as "verify the certificate"; libpq (and the * BAETES API) only require encryption. Keep the libpq meaning so both APIs share DATABASE_URL. */ export function pgConnectionString(url: string): string { const parsed = new URL(url); if (parsed.searchParams.has('sslmode') && !parsed.searchParams.has('uselibpqcompat')) { parsed.searchParams.set('uselibpqcompat', 'true'); } return parsed.toString(); }