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; } }