2
0
Files
cal/calcom/packages/prisma/is-prisma-available-check.ts
2024-08-09 00:39:27 +02:00

18 lines
380 B
TypeScript

import { Prisma } from "@prisma/client";
import prisma from ".";
export async function isPrismaAvailableCheck() {
try {
await prisma.$queryRaw`SELECT 1`;
return true;
} catch (e: unknown) {
if (e instanceof Prisma.PrismaClientInitializationError) {
// Database might not available at build time.
return false;
} else {
throw e;
}
}
}