prisma.ts und vile.config

This commit is contained in:
titver968
2025-11-27 15:26:22 +01:00
parent 9173229ad1
commit 0f9fbbf177
2 changed files with 19 additions and 3 deletions

16
src/lib/server/prisma.ts Normal file
View File

@@ -0,0 +1,16 @@
// src/lib/server/prisma.ts
import { PrismaClient } from '@prisma/client';
const globalForPrisma = globalThis as unknown as {
prisma: PrismaClient | undefined;
};
export const prisma =
globalForPrisma.prisma ??
new PrismaClient({
log: ['error', 'warn'],
});
if (process.env.NODE_ENV !== 'production') {
globalForPrisma.prisma = prisma;
}