daphnis/lib/prisma.ts

21 lines
668 B
TypeScript
Raw Normal View History

2024-06-29 06:02:58 +00:00
import { PrismaClient as daphnisClient } from "@/prisma/schemas/daphnis/generated/daphnis";
2024-06-29 05:22:22 +00:00
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;