daphnis/lib/prisma.ts
2024-06-29 03:02:21 -04:00

21 lines
668 B
TypeScript

import { PrismaClient as daphnisClient } from "@/prisma/schemas/daphnis/generated/daphnis";
import { PrismaClient as artemisClient } from "@/prisma/schemas/artemis/generated/artemis";
const DaphnisSingleton = () => {
return new daphnisClient();
};
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;