cal.pub0.org/lib/prisma.ts

19 lines
356 B
TypeScript

import { PrismaClient } from "@prisma/client";
declare global {
// eslint-disable-next-line no-var
var prisma: PrismaClient | undefined;
}
export const prisma =
globalThis.prisma ||
new PrismaClient({
log: ["query", "error", "warn"],
});
if (process.env.NODE_ENV !== "production") {
globalThis.prisma = prisma;
}
export default prisma;