fix: update db.ts to refresh cached Prisma client for Prompt model
This commit is contained in:
@@ -15,8 +15,12 @@ const globalForPrisma = globalThis as unknown as {
|
|||||||
|
|
||||||
function getPrismaClient(): PrismaClient {
|
function getPrismaClient(): PrismaClient {
|
||||||
if (process.env.NODE_ENV !== 'production' && globalForPrisma.prisma) {
|
if (process.env.NODE_ENV !== 'production' && globalForPrisma.prisma) {
|
||||||
// Check if newly added models (e.g. category) exist on cached client
|
// Ensure all models (category, cheatsheet, prompt) exist on cached client
|
||||||
if ((globalForPrisma.prisma as any).category) {
|
if (
|
||||||
|
(globalForPrisma.prisma as any).category &&
|
||||||
|
(globalForPrisma.prisma as any).cheatsheet &&
|
||||||
|
(globalForPrisma.prisma as any).prompt
|
||||||
|
) {
|
||||||
return globalForPrisma.prisma;
|
return globalForPrisma.prisma;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user