Dental Care
This commit is contained in:
19
lib/types/prisma.ts
Normal file
19
lib/types/prisma.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
import { PrismaClient } from '@prisma/client'
|
||||
|
||||
const globalForPrisma = globalThis as unknown as {
|
||||
prisma: PrismaClient | undefined
|
||||
}
|
||||
|
||||
/**
|
||||
* Prisma Client Configuration
|
||||
*
|
||||
* Important for MongoDB:
|
||||
* - No connection pooling needed (MongoDB handles it)
|
||||
* - Ensure DATABASE_URL uses mongodb:// or mongodb+srv:// protocol
|
||||
* - Disable Prisma Accelerate (not compatible with MongoDB)
|
||||
*/
|
||||
export const prisma = globalForPrisma.prisma ?? new PrismaClient({
|
||||
log: process.env.NODE_ENV === 'development' ? ['query', 'error', 'warn'] : ['error'],
|
||||
})
|
||||
|
||||
if (process.env.NODE_ENV !== 'production') globalForPrisma.prisma = prisma
|
||||
Reference in New Issue
Block a user