Update index.ts

This commit is contained in:
zomars
2022-06-03 13:21:46 -06:00
parent debbd980d9
commit 4569a96e78
+6 -6
View File
@@ -1,4 +1,4 @@
import { PrismaClient } from "@prisma/client";
import { Prisma, PrismaClient } from "@prisma/client";
import { bookingReferenceMiddleware } from "./middleware";
@@ -7,11 +7,11 @@ declare global {
var prisma: PrismaClient | undefined;
}
export const prisma =
globalThis.prisma ||
new PrismaClient({
// log: ["query", "error", "warn"],
});
const prismaOptions: Prisma.PrismaClientOptions = {};
if (!!process.env.NEXT_PUBLIC_DEBUG) prismaOptions.log = ["query", "error", "warn"];
export const prisma = globalThis.prisma || new PrismaClient(prismaOptions);
if (process.env.NODE_ENV !== "production") {
globalThis.prisma = prisma;