aboutsummaryrefslogtreecommitdiffstats
path: root/packages/db/index.ts
blob: e87b9515519ddc3943367243dc84a15f5eedc07d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
import { PrismaClient } from "@prisma/client";

const globalForPrisma = globalThis as unknown as {
  prisma: PrismaClient | undefined;
};

export const prisma =
  globalForPrisma.prisma ??
  new PrismaClient({
    log:
      process.env.NODE_ENV === "development"
        ? ["query", "error", "warn"]
        : ["error"],
  });