mirror of
https://github.com/jakejarvis/jarv.is.git
synced 2025-04-27 02:18:29 -04:00
23 lines
558 B
TypeScript
23 lines
558 B
TypeScript
import { PrismaClient } from "@prisma/client";
|
|
import { IS_DEV_SERVER } from "../config/constants";
|
|
|
|
// 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 (IS_DEV_SERVER) global.prisma = prisma;
|