We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 7096c98 + 1a3a21d commit 9629299Copy full SHA for 9629299
src/lib/prisma.ts
@@ -1,3 +1,9 @@
1
-import { PrismaClient } from "@prisma/client";
+import { PrismaClient } from '@prisma/client'
2
3
-export const prisma = new PrismaClient();
+const globalForPrisma = globalThis as unknown as {
4
+ prisma: PrismaClient | undefined
5
+}
6
+
7
+export const prisma = globalForPrisma.prisma ?? new PrismaClient()
8
9
+if (process.env.NODE_ENV !== 'production') globalForPrisma.prisma = prisma
0 commit comments