fix: Prisma 7 runtime with PrismaPg adapter + pg driver

This commit is contained in:
2026-04-26 20:49:00 +05:00
parent 275f419a41
commit 9dde5c21dd
5 changed files with 18 additions and 10 deletions
+6
View File
@@ -1,9 +1,15 @@
import { PrismaPg } from '@prisma/adapter-pg'
import { Pool } from 'pg'
import PrismaPkg from '@prisma/client'
const { PrismaClient } = PrismaPkg
const pool = new Pool({ connectionString: process.env.DATABASE_URL })
const adapter = new PrismaPg(pool)
const globalForPrisma = globalThis as unknown as { prisma: InstanceType<typeof PrismaClient> }
export const prisma = globalForPrisma.prisma || new PrismaClient({
adapter,
log: process.env.NODE_ENV === 'development' ? ['query', 'error', 'warn'] : ['error']
})