1
mirror of https://github.com/jakejarvis/jarv.is.git synced 2025-07-19 14:15:29 -04:00

remove prisma accelerate extension

This commit is contained in:
2025-02-14 17:26:11 -05:00
parent 5926713b9a
commit c1ed417003
9 changed files with 96 additions and 112 deletions

View File

@@ -1,12 +1,17 @@
import { PrismaClient } from "@prisma/client/edge";
import { withAccelerate } from "@prisma/extension-accelerate";
import { PrismaClient } from "@prisma/client";
// 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 globalForPrisma = global as unknown as { prisma: PrismaClient };
const prismaClientSingleton = () => {
return new PrismaClient();
};
export const prisma = globalForPrisma.prisma || new PrismaClient().$extends(withAccelerate());
declare const globalThis: {
prismaGlobal: ReturnType<typeof prismaClientSingleton>;
} & typeof global;
if (process.env.NODE_ENV !== "production") globalForPrisma.prisma = prisma;
export const prisma = globalThis.prismaGlobal ?? prismaClientSingleton();
if (process.env.NODE_ENV !== "production") globalThis.prismaGlobal = prisma;