16 lines
496 B
TypeScript
16 lines
496 B
TypeScript
import { PrismaClient } from "@prisma/client";
|
|
|
|
const globalForPrisma = globalThis as unknown as {
|
|
prisma: PrismaClient | undefined;
|
|
};
|
|
|
|
export const prisma =
|
|
globalForPrisma.prisma ??
|
|
new PrismaClient({
|
|
// In Prisma 7, the connection URL should ideally come from prisma.config.ts
|
|
// or passed here if not using the new config system.
|
|
// For now, let's see if it picks up the URL automatically.
|
|
});
|
|
|
|
if (process.env.NODE_ENV !== "production") globalForPrisma.prisma = prisma;
|