mirror of
https://github.com/aaronpo97/the-biergarten-app.git
synced 2026-02-16 20:13:49 +00:00
Restructure codebase to use src directory
This commit is contained in:
18
src/prisma/DBClient.ts
Normal file
18
src/prisma/DBClient.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
import { PrismaClient } from '@prisma/client';
|
||||
import { NODE_ENV } from '@/config/env';
|
||||
|
||||
const globalForPrisma = global as unknown as { prisma: PrismaClient };
|
||||
|
||||
const DBClient = {
|
||||
instance:
|
||||
globalForPrisma.prisma ||
|
||||
new PrismaClient({
|
||||
log: ['info', 'warn'],
|
||||
}),
|
||||
};
|
||||
|
||||
if (NODE_ENV !== 'production') {
|
||||
globalForPrisma.prisma = DBClient.instance;
|
||||
}
|
||||
|
||||
export default DBClient;
|
||||
Reference in New Issue
Block a user