Apply full refactor updates plus pipeline/email UX confirmations
All checks were successful
Build and Push Docker Image / build (push) Successful in 10m33s
All checks were successful
Build and Push Docker Image / build (push) Successful in 10m33s
This commit is contained in:
@@ -1,26 +1,26 @@
|
||||
import { PrismaClient } from '@prisma/client'
|
||||
|
||||
const globalForPrisma = globalThis as unknown as {
|
||||
prisma: PrismaClient | undefined
|
||||
}
|
||||
|
||||
function getDatasourceUrl(): string | undefined {
|
||||
const url = process.env.DATABASE_URL
|
||||
if (!url) return undefined
|
||||
// Append connection pool params if not already present
|
||||
if (url.includes('connection_limit')) return url
|
||||
const separator = url.includes('?') ? '&' : '?'
|
||||
return `${url}${separator}connection_limit=20&pool_timeout=10`
|
||||
}
|
||||
|
||||
export const prisma =
|
||||
globalForPrisma.prisma ??
|
||||
new PrismaClient({
|
||||
datasourceUrl: getDatasourceUrl(),
|
||||
log:
|
||||
process.env.NODE_ENV === 'development'
|
||||
? ['query', 'error', 'warn']
|
||||
: ['error'],
|
||||
})
|
||||
|
||||
if (process.env.NODE_ENV !== 'production') globalForPrisma.prisma = prisma
|
||||
import { PrismaClient } from '@prisma/client'
|
||||
|
||||
const globalForPrisma = globalThis as unknown as {
|
||||
prisma: PrismaClient | undefined
|
||||
}
|
||||
|
||||
function getDatasourceUrl(): string | undefined {
|
||||
const url = process.env.DATABASE_URL
|
||||
if (!url) return undefined
|
||||
// Append connection pool params if not already present
|
||||
if (url.includes('connection_limit')) return url
|
||||
const separator = url.includes('?') ? '&' : '?'
|
||||
return `${url}${separator}connection_limit=20&pool_timeout=10`
|
||||
}
|
||||
|
||||
export const prisma =
|
||||
globalForPrisma.prisma ??
|
||||
new PrismaClient({
|
||||
datasourceUrl: getDatasourceUrl(),
|
||||
log:
|
||||
process.env.NODE_ENV === 'development'
|
||||
? ['query', 'error', 'warn']
|
||||
: ['error'],
|
||||
})
|
||||
|
||||
if (process.env.NODE_ENV !== 'production') globalForPrisma.prisma = prisma
|
||||
|
||||
Reference in New Issue
Block a user