From 5b13c3c91158996cd9a63c9a61f8da1a1868d4ba Mon Sep 17 00:00:00 2001 From: Rizky Date: Thu, 25 Jan 2024 13:54:02 +0700 Subject: [PATCH] wip fix --- pkgs/utils/prisma.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pkgs/utils/prisma.ts b/pkgs/utils/prisma.ts index 6407efe..cab0df6 100644 --- a/pkgs/utils/prisma.ts +++ b/pkgs/utils/prisma.ts @@ -8,8 +8,12 @@ export const preparePrisma = async () => { if (!(await existsAsync(dir("node_modules/.prisma")))) { await $({ cwd: dir(`app/db`) })`bun prisma generate`; } - const { PrismaClient } = await import("../../app/db/db"); - g.db = new PrismaClient(); + try { + const { PrismaClient } = await import("../../app/db/db"); + g.db = new PrismaClient(); + } catch (e) { + console.log("Prisma not initialized"); + } } g.dburl = process.env.DATABASE_URL || "";