13 lines
355 B
TypeScript
13 lines
355 B
TypeScript
import { PrismaClient } from '@prisma/client'
|
|
|
|
const prismaClientSingleton = () => {
|
|
return new PrismaClient()
|
|
}
|
|
|
|
declare global { }
|
|
|
|
declare const globalThis: {
|
|
prismaGlobal: ReturnType<typeof prismaClientSingleton>;
|
|
} & typeof global;
|
|
|
|
export const db = globalThis.prismaGlobal ?? prismaClientSingleton() // Creating a new instance of PrismaClient.
|