Scrum4Me/lib/prisma.ts
janpeter visser b541379964 chore: SQLite verwijderd — alleen PostgreSQL via Neon
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-25 12:15:19 +02:00

21 lines
696 B
TypeScript

import { PrismaClient } from '@prisma/client'
import { Pool } from 'pg'
import { PrismaPg } from '@prisma/adapter-pg'
function createPrismaClient() {
const url = process.env.DATABASE_URL
if (!url) throw new Error('DATABASE_URL is not set')
const pool = new Pool({ connectionString: url })
const adapter = new PrismaPg(pool)
return new PrismaClient({
adapter,
log: process.env.NODE_ENV === 'development' ? ['error', 'warn'] : ['error'],
})
}
const globalForPrisma = globalThis as unknown as { prisma: PrismaClient | undefined }
export const prisma = globalForPrisma.prisma ?? createPrismaClient()
if (process.env.NODE_ENV !== 'production') globalForPrisma.prisma = prisma