mirror of
https://github.com/jakejarvis/jarv.is.git
synced 2025-07-20 20:21:18 -04:00
migrate to prisma accelerate
https://prismaio.notion.site/Migration-Guide-For-Data-Proxy-Users-Moving-to-Prisma-Accelerate-5df9
This commit is contained in:
@@ -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>;
|
||||
|
Reference in New Issue
Block a user