Files
e2b-dev--e2b/db/prisma.ts
T
Tomas Valenta 5657959379 Remove src
2023-03-07 22:22:50 +01:00

18 lines
432 B
TypeScript

import { PrismaClient } from '@prisma/client'
export * from '@prisma/client'
let prisma: PrismaClient
//check if we are running in production mode
if (process.env.NODE_ENV === 'production') {
prisma = new PrismaClient()
} else {
//check if there is already a connection to the database
if (!(global as any).prisma) {
(global as any).prisma = new PrismaClient()
}
prisma = (global as any).prisma
}
export { prisma }