From 3ef73391e5b13b40fb3e5fd11a83a62d4e5b1256 Mon Sep 17 00:00:00 2001 From: pawelblaszczyk5 Date: Thu, 4 Jan 2024 20:46:29 +0100 Subject: [PATCH] Experiment --- prisma/deploy.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/prisma/deploy.ts b/prisma/deploy.ts index 3115f66..9a251f0 100644 --- a/prisma/deploy.ts +++ b/prisma/deploy.ts @@ -1,3 +1,6 @@ +/* eslint-disable no-console -- These logs are for debugging */ + +import { PrismaClient } from '@prisma/client'; import { $ } from 'execa'; const MAX_RETRIES = 5; @@ -11,7 +14,6 @@ const deployPrismaMigrationsWithRetrying = () => { try { const { stdout } = await $`pnpm prisma migrate deploy`; - // eslint-disable-next-line no-console -- this is for debugging in deployment logs console.log(stdout); } catch (error) { if (currentRetry >= MAX_RETRIES) throw error; @@ -20,10 +22,15 @@ const deployPrismaMigrationsWithRetrying = () => { if (!isDatabaseUnavailable) throw error; + try { + await new PrismaClient().$connect(); + } catch (error_) { + console.log(error_); + } + const delayMs = BASE_DELAY * 2 ** currentRetry; currentRetry += 1; - // eslint-disable-next-line no-console -- this is for debugging in deployment logs console.log(`Retrying migrations #${currentRetry} after ${delayMs}ms`); await new Promise(resolve => {