mirror of
https://github.com/jakejarvis/jarv.is.git
synced 2025-04-27 09:58:28 -04:00
22 lines
529 B
TypeScript
22 lines
529 B
TypeScript
import { PrismaClient } from "@prisma/client";
|
|
|
|
// PrismaClient is attached to the `global` object in development to prevent
|
|
// exhausting your database connection limit.
|
|
//
|
|
// Learn more:
|
|
// https://pris.ly/d/help/next-js-best-practices
|
|
|
|
declare global {
|
|
// allow global `var` declarations
|
|
// eslint-disable-next-line no-var
|
|
var prisma: PrismaClient | undefined;
|
|
}
|
|
|
|
export const prisma =
|
|
global.prisma ||
|
|
new PrismaClient({
|
|
log: ["query"],
|
|
});
|
|
|
|
if (process.env.NODE_ENV !== "production") global.prisma = prisma;
|