mirror of
https://github.com/run-llama/auto_rfp.git
synced 2026-07-22 20:45:27 -04:00
13 lines
479 B
TypeScript
13 lines
479 B
TypeScript
import { PrismaClient } from '@prisma/client';
|
|
|
|
// PrismaClient is attached to the `global` object in development to prevent
|
|
// exhausting your database connection limit.
|
|
const globalForPrisma = global as unknown as { prisma: PrismaClient };
|
|
|
|
export const db =
|
|
globalForPrisma.prisma ||
|
|
new PrismaClient({
|
|
log: process.env.NODE_ENV === 'development' ? ['query', 'error', 'warn'] : ['error'],
|
|
});
|
|
|
|
if (process.env.NODE_ENV !== 'production') globalForPrisma.prisma = db;
|