mirror of
https://github.com/aaronpo97/the-biergarten-app.git
synced 2026-02-16 20:13:49 +00:00
18 lines
364 B
TypeScript
18 lines
364 B
TypeScript
import { PrismaClient } from '@prisma/client';
|
|
|
|
const globalForPrisma = global as unknown as { prisma: PrismaClient };
|
|
|
|
const DBClient = {
|
|
instance:
|
|
globalForPrisma.prisma ||
|
|
new PrismaClient({
|
|
log: ['info', 'warn'],
|
|
}),
|
|
};
|
|
|
|
if (process.env.NODE_ENV !== 'production') {
|
|
globalForPrisma.prisma = DBClient.instance;
|
|
}
|
|
|
|
export default DBClient;
|