daphnis/lib/prisma.ts
2024-06-29 02:37:50 -04:00

21 lines
666 B
TypeScript

import { PrismaClient as dahnisClient } from "@/prisma/schemas/daphnis/generated/daphnis";
import { PrismaClient as artemisClient } from "@/prisma/schemas/artemis/generated/artemis";
const DaphnisSingleton = () => {
return new dahnisClient();
};
const aremisSingleton = () => {
return new artemisClient();
};
declare global {
var daphnis: undefined | ReturnType<typeof DaphnisSingleton>;
var artemis: undefined | ReturnType<typeof aremisSingleton>;
}
export const daphnis = globalThis.daphnis ?? DaphnisSingleton();
export const artemis = globalThis.artemis ?? aremisSingleton();
if (process.env.NODE_ENV !== "production") globalThis.daphnis = daphnis;