add prisma

This commit is contained in:
Janis
2022-12-27 01:57:49 +01:00
parent df3942bcbd
commit ff723b2402
91 changed files with 1323 additions and 1704 deletions

14
lib/prisma.ts Normal file
View File

@@ -0,0 +1,14 @@
import { PrismaClient } from '@prisma/client';
let prisma: PrismaClient;
if (process.env.NODE_ENV === 'production') {
prisma = new PrismaClient();
} else {
if (!global.prisma) {
global.prisma = new PrismaClient();
}
prisma = global.prisma;
}
export default prisma;