update global (texte + logo)
This commit is contained in:
19
Linkwarden/lib/api/db.ts
Normal file
19
Linkwarden/lib/api/db.ts
Normal file
@ -0,0 +1,19 @@
|
||||
import { PrismaClient } from "@prisma/client";
|
||||
|
||||
const globalForPrisma = global as unknown as { prisma: PrismaClient };
|
||||
|
||||
export const prisma =
|
||||
globalForPrisma.prisma ||
|
||||
new PrismaClient({
|
||||
log: ["query"],
|
||||
});
|
||||
|
||||
if (process.env.NODE_ENV !== "production") globalForPrisma.prisma = prisma;
|
||||
|
||||
// For benchmarking | uncomment when needed
|
||||
// if (process.env.NODE_ENV !== "production")
|
||||
// prisma.$on("query" as any, (e: any) => {
|
||||
// console.log("Query: " + e.query);
|
||||
// console.log("Params: " + e.params);
|
||||
// console.log("\x1b[31m", `Duration: ${e.duration}ms`, "\x1b[0m");
|
||||
// });
|
Reference in New Issue
Block a user