mirror of
https://github.com/aaronpo97/the-biergarten-app.git
synced 2026-02-16 20:13:49 +00:00
Fix beer likes and db client
This commit is contained in:
@@ -1,11 +1,17 @@
|
||||
import { PrismaClient } from '@prisma/client';
|
||||
|
||||
const globalForPrisma = global as unknown as { prisma: PrismaClient };
|
||||
|
||||
const DBClient = {
|
||||
instance: new PrismaClient(),
|
||||
instance:
|
||||
globalForPrisma.prisma ||
|
||||
new PrismaClient({
|
||||
log: ['info', 'warn'],
|
||||
}),
|
||||
};
|
||||
|
||||
export type IDBClient = typeof DBClient;
|
||||
|
||||
Object.freeze(DBClient);
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
globalForPrisma.prisma = DBClient.instance;
|
||||
}
|
||||
|
||||
export default DBClient;
|
||||
|
||||
Reference in New Issue
Block a user