From 29bbac3c39625be2f16b9157c3591f82149abe8a Mon Sep 17 00:00:00 2001 From: AyrisAI Date: Thu, 23 Jul 2026 17:40:14 +0300 Subject: [PATCH] fix: update db.ts to refresh cached Prisma client for Prompt model --- lib/db.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/db.ts b/lib/db.ts index 8c84002..50f04e4 100644 --- a/lib/db.ts +++ b/lib/db.ts @@ -15,8 +15,12 @@ const globalForPrisma = globalThis as unknown as { function getPrismaClient(): PrismaClient { if (process.env.NODE_ENV !== 'production' && globalForPrisma.prisma) { - // Check if newly added models (e.g. category) exist on cached client - if ((globalForPrisma.prisma as any).category) { + // Ensure all models (category, cheatsheet, prompt) exist on cached client + if ( + (globalForPrisma.prisma as any).category && + (globalForPrisma.prisma as any).cheatsheet && + (globalForPrisma.prisma as any).prompt + ) { return globalForPrisma.prisma; } }