mirror of
https://github.com/OwethuManagedServices/oms-website-nextjs.git
synced 2025-12-17 15:38:09 +00:00
22 lines
522 B
TypeScript
22 lines
522 B
TypeScript
import { PrismaClient } from "@prisma/client";
|
|
|
|
// PrismaClient is attached to the `global` object in development to prevent
|
|
// exhausting your database connection limit.
|
|
declare global {
|
|
// eslint-disable-next-line no-var
|
|
var prisma: PrismaClient | undefined;
|
|
}
|
|
|
|
export const prisma =
|
|
global.prisma ||
|
|
new PrismaClient({
|
|
log:
|
|
process.env.NODE_ENV === "development"
|
|
? ["query", "error", "warn"]
|
|
: ["error"],
|
|
});
|
|
|
|
if (process.env.NODE_ENV !== "production") {
|
|
global.prisma = prisma;
|
|
}
|