mirror of
https://github.com/Drop-OSS/drop.git
synced 2025-11-09 20:12:10 +10:00
15 lines
391 B
TypeScript
15 lines
391 B
TypeScript
import { PrismaClient } from '@prisma/client'
|
|
|
|
const prismaClientSingleton = () => {
|
|
return new PrismaClient()
|
|
}
|
|
|
|
declare const globalThis: {
|
|
prismaGlobal: ReturnType<typeof prismaClientSingleton>;
|
|
} & typeof global;
|
|
|
|
const prisma = globalThis.prismaGlobal ?? prismaClientSingleton()
|
|
|
|
export default prisma
|
|
|
|
if (process.env.NODE_ENV !== 'production') globalThis.prismaGlobal = prisma |