2023-03-15 08:35:16 +01:00
|
|
|
import { PrismaClient } from '@typebot.io/prisma'
|
2021-12-23 16:31:56 +01:00
|
|
|
|
|
|
|
|
declare const global: { 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
|