From 22460a460b3ac1fa5de8cde742c82e0d0dafd076 Mon Sep 17 00:00:00 2001 From: Agusti Fernandez Pardo <6601142+agustif@users.noreply.github.com> Date: Tue, 14 Jun 2022 19:11:39 +0200 Subject: [PATCH] feat: Adds new customPrisma for hosted API (#3055) * feat: customPrisma for hosted API access * fix: 24h not 24 days for expiry cache in customPrisma calls * fix: move PRISMA_CLIENT_CACHING_TIME to API Co-authored-by: Agusti Fernandez Pardo Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com> --- packages/prisma/index.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/prisma/index.ts b/packages/prisma/index.ts index 28eb069042..c21fe3db77 100644 --- a/packages/prisma/index.ts +++ b/packages/prisma/index.ts @@ -13,6 +13,9 @@ if (!!process.env.NEXT_PUBLIC_DEBUG) prismaOptions.log = ["query", "error", "war export const prisma = globalThis.prisma || new PrismaClient(prismaOptions); +export const customPrisma = (options: Prisma.PrismaClientOptions) => + new PrismaClient({ ...prismaOptions, ...options }); + if (process.env.NODE_ENV !== "production") { globalThis.prisma = prisma; }