fix: Prisma 7 runtime with PrismaPg adapter + pg driver
This commit is contained in:
@@ -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']
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user