tasko/lib/db.ts

10 lines
235 B
TypeScript
Raw Normal View History

2024-02-16 01:49:19 +00:00
import { PrismaClient } from '@prisma/client';
2024-02-15 02:30:10 +00:00
declare global {
var prisma: PrismaClient | undefined;
}
export const db = globalThis.prisma ?? new PrismaClient();
2024-02-16 01:49:19 +00:00
if (process.env.NODE_ENV !== 'production') globalThis.prisma = db;