| 12345678910111213141516 |
- /**
- * Singleton Prisma client instance.
- */
- import { PrismaClient } from '@prisma/client';
- // Global singleton to prevent multiple instances in development
- const globalForPrisma = globalThis as unknown as { prisma: PrismaClient | undefined };
- export const prisma = globalForPrisma.prisma ?? new PrismaClient({
- log: process.env['LOG_LEVEL'] === 'debug' ? ['query', 'info', 'warn', 'error'] : ['warn', 'error'],
- });
- if (process.env['NODE_ENV'] !== 'production') {
- globalForPrisma.prisma = prisma;
- }
|