2021-07-06 16:10:22 +00:00
|
|
|
import { PrismaClient } from "@prisma/client";
|
2021-03-22 13:48:48 +00:00
|
|
|
|
2021-10-15 18:31:57 +00:00
|
|
|
declare global {
|
|
|
|
// eslint-disable-next-line no-var
|
|
|
|
var prisma: PrismaClient | undefined;
|
2021-03-22 13:48:48 +00:00
|
|
|
}
|
|
|
|
|
2021-10-15 18:31:57 +00:00
|
|
|
export const prisma =
|
|
|
|
globalThis.prisma ||
|
|
|
|
new PrismaClient({
|
|
|
|
log: ["query", "error", "warn"],
|
2021-07-06 16:10:22 +00:00
|
|
|
});
|
|
|
|
|
2021-10-15 18:31:57 +00:00
|
|
|
if (process.env.NODE_ENV !== "production") {
|
|
|
|
globalThis.prisma = prisma;
|
|
|
|
}
|
2021-07-06 16:10:22 +00:00
|
|
|
|
|
|
|
export default prisma;
|