♻️ Export bot-engine code into its own package
This commit is contained in:
16
packages/lib/prisma.ts
Normal file
16
packages/lib/prisma.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import { env } from '@typebot.io/env'
|
||||
import { PrismaClient } from '@typebot.io/prisma'
|
||||
|
||||
declare const global: { prisma: PrismaClient }
|
||||
let prisma: PrismaClient
|
||||
|
||||
if (env.NODE_ENV === 'production') {
|
||||
prisma = new PrismaClient()
|
||||
} else {
|
||||
if (!global.prisma) {
|
||||
global.prisma = new PrismaClient()
|
||||
}
|
||||
prisma = global.prisma
|
||||
}
|
||||
|
||||
export default prisma
|
||||
Reference in New Issue
Block a user