import { PrismaClient } from '@prisma/client' import { env } from '@/lib/utils' const prismaClientSingleton = () => { return new PrismaClient() } declare global { var prismaGlobal: undefined | ReturnType } const db = globalThis.prismaGlobal ?? prismaClientSingleton() export default db if (env('NODE_ENV') !== 'production') globalThis.prismaGlobal = db