fix: update db.ts to refresh cached Prisma client for Prompt model

This commit is contained in:
AyrisAI
2026-07-23 17:40:14 +03:00
parent bf4e0da112
commit 29bbac3c39
+6 -2
View File
@@ -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;
}
}