cal.pub0.org/lib/prisma.ts

14 lines
273 B
TypeScript
Raw Normal View History

2021-03-22 13:48:48 +00:00
import { PrismaClient } from '@prisma/client'
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