15 lines
307 B
TypeScript
15 lines
307 B
TypeScript
|
|
import { PrismaClient } from "@prisma/client";
|
||
|
|
|
||
|
|
declare global {
|
||
|
|
// eslint-disable-next-line no-var
|
||
|
|
var __dreamePrisma: PrismaClient | undefined;
|
||
|
|
}
|
||
|
|
|
||
|
|
const db = global.__dreamePrisma ?? new PrismaClient();
|
||
|
|
|
||
|
|
if (process.env.NODE_ENV !== "production") {
|
||
|
|
global.__dreamePrisma = db;
|
||
|
|
}
|
||
|
|
|
||
|
|
export default db;
|