cal.pub0.org/lib/prisma.ts

21 lines
389 B
TypeScript
Raw Permalink Normal View History

import { PrismaClient } from "@prisma/client";
2021-03-22 13:48:48 +00:00
import { IS_PRODUCTION } from "@lib/config/constants";
declare global {
// eslint-disable-next-line no-var
var prisma: PrismaClient | undefined;
2021-03-22 13:48:48 +00:00
}
export const prisma =
globalThis.prisma ||
new PrismaClient({
log: ["query", "error", "warn"],
});
if (!IS_PRODUCTION) {
globalThis.prisma = prisma;
}
export default prisma;