mirror of
https://github.com/massbug/judge4c.git
synced 2025-05-18 07:16:34 +00:00
chore(lib): add prisma client initialization
This commit is contained in:
parent
aacd5dccde
commit
214f4fabef
11
src/lib/prisma.ts
Normal file
11
src/lib/prisma.ts
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
import { PrismaClient } from '@prisma/client';
|
||||||
|
|
||||||
|
const prisma = new PrismaClient();
|
||||||
|
|
||||||
|
const globalForPrisma = global as unknown as { prisma: typeof prisma };
|
||||||
|
|
||||||
|
if (process.env.NODE_ENV !== 'production') {
|
||||||
|
globalForPrisma.prisma = prisma;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default prisma;
|
Loading…
Reference in New Issue
Block a user