Files
old.cms.fellies.org/packages/db/src/client.ts
Citali a57464d818
Some checks failed
CMS CI / Governance Checks (push) Successful in 1m6s
CMS CI / Lint Typecheck Unit E2E (push) Failing after 1m8s
chore(repo): remove theoretical workflow and fix prisma ci generation
2026-02-11 18:26:42 +01:00

23 lines
524 B
TypeScript

import { PrismaPg } from "@prisma/adapter-pg"
import { PrismaClient } from "@prisma/client"
import { Pool } from "pg"
const connectionString = process.env.DATABASE_URL
if (!connectionString) {
throw new Error("DATABASE_URL is not set")
}
const pool = new Pool({ connectionString })
const adapter = new PrismaPg(pool)
declare global {
var prisma: PrismaClient | undefined
}
export const db = globalThis.prisma ?? new PrismaClient({ adapter })
if (process.env.NODE_ENV !== "production") {
globalThis.prisma = db
}