Commit 0220b858 authored by Hendrik Garske's avatar Hendrik Garske

Fix: Prisma Client Initialisierung mit datasourceUrl für Prisma 7

parent 3135af5b
Pipeline #8 failed with stages
in 27 seconds
......@@ -4,9 +4,14 @@ const globalForPrisma = globalThis as unknown as {
prisma: PrismaClient | undefined
}
export const prisma = globalForPrisma.prisma ?? new PrismaClient({
log: process.env.NODE_ENV === 'development' ? ['query', 'error', 'warn'] : ['error'],
})
const createPrismaClient = () => {
return new PrismaClient({
datasourceUrl: process.env.DATABASE_URL,
log: process.env.NODE_ENV === 'development' ? ['query', 'error', 'warn'] : ['error'],
})
}
export const prisma = globalForPrisma.prisma ?? createPrismaClient()
if (process.env.NODE_ENV !== 'production') globalForPrisma.prisma = prisma
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment