mirror of
https://github.com/lukevella/rallly.git
synced 2025-04-28 17:56:37 +02:00
19 lines
486 B
TypeScript
19 lines
486 B
TypeScript
import { PrismaClient } from "@prisma/client";
|
|
|
|
export type * from "@prisma/client";
|
|
|
|
const prismaClientSingleton = () => {
|
|
return new PrismaClient();
|
|
};
|
|
|
|
export type ExtendedPrismaClient = ReturnType<typeof prismaClientSingleton>;
|
|
|
|
declare const globalThis: {
|
|
prismaGlobal: ExtendedPrismaClient;
|
|
} & typeof global;
|
|
|
|
const prisma = globalThis.prismaGlobal ?? prismaClientSingleton();
|
|
|
|
export { prisma };
|
|
|
|
if (process.env.NODE_ENV !== "production") globalThis.prismaGlobal = prisma;
|