1
mirror of https://github.com/jakejarvis/jarv.is.git synced 2025-07-20 20:21:18 -04:00
2023-10-04 12:27:49 -04:00
parent bc77e502b9
commit 14cd879207
6 changed files with 39 additions and 17 deletions

View File

@@ -1,11 +1,12 @@
import { PrismaClient } from "@prisma/client/edge";
import { withAccelerate } from "@prisma/extension-accelerate";
// creating PrismaClient here prevents next.js from starting too many concurrent prisma instances and exhausting the
// number of connection pools available (especially when hot reloading from `next dev`).
// https://www.prisma.io/docs/guides/other/troubleshooting-orm/help-articles/nextjs-prisma-client-dev-practices
const prismaClientSingleton = () => {
return new PrismaClient();
return new PrismaClient().$extends(withAccelerate());
};
type PrismaClientSingleton = ReturnType<typeof prismaClientSingleton>;