cal.pub0.org/packages/prisma/index.ts

22 lines
477 B
TypeScript

import { PrismaClient } from "@prisma/client";
import { bookingReferenceMiddleware } from "./middleware";
declare global {
var prisma: PrismaClient | undefined;
}
export const prisma =
globalThis.prisma ||
new PrismaClient({
// log: ["query", "error", "warn"],
});
if (process.env.NODE_ENV !== "production") {
globalThis.prisma = prisma;
}
// If any changed on middleware server restart is required
bookingReferenceMiddleware(prisma);
export default prisma;