You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
321 B
19 lines
321 B
import { PrismaClient } from "@prisma/client";
|
|
|
|
declare global {
|
|
var prisma: PrismaClient;
|
|
}
|
|
|
|
let prisma: PrismaClient;
|
|
|
|
if (process.env.NODE_ENV === "production") {
|
|
prisma = new PrismaClient();
|
|
} else {
|
|
if (!global.prisma) {
|
|
global.prisma = new PrismaClient();
|
|
}
|
|
|
|
prisma = global.prisma;
|
|
}
|
|
export default prisma;
|