pg
import { Database } from "@/lib/kysely/types";import { Pool } from "pg";import { Kysely, PostgresDialect } from "kysely";const dbClientSingleton = () => { const dialect = new PostgresDialect({ pool: new Pool({ max: 10, connectionString: process.env.DATABASE_URL!, }), }); return new Kysely<Database>({ log(event) { if (event.level === "query") { console.log(event.query.sql); console.log(event.query.parameters); } }, dialect, });};declare global { var db: undefined | ReturnType<typeof dbClientSingleton>;}const db = globalThis.db ?? dbClientSingleton();export default db;if (process.env.NODE_ENV !== "production") globalThis.db = db;