From 8edf748d30825c4373aa51371df1866709d1b61b Mon Sep 17 00:00:00 2001 From: Alexey Zinoviev Date: Mon, 21 Oct 2024 16:18:30 +0400 Subject: [PATCH] Qfix: Extend patch version values range in PG (#7005) Signed-off-by: Alexey Zinoviev --- server/account/src/collections/postgres.ts | 13 ++++++++++++- server/client/src/account.ts | 10 +++++++++- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/server/account/src/collections/postgres.ts b/server/account/src/collections/postgres.ts index 09993fc848..906f4913d1 100644 --- a/server/account/src/collections/postgres.ts +++ b/server/account/src/collections/postgres.ts @@ -531,7 +531,7 @@ export class PostgresAccountDB implements AccountDB { } protected getMigrations (): [string, string][] { - return [this.getV1Migration()] + return [this.getV1Migration(), this.getV2Migration()] } // NOTE: NEVER MODIFY EXISTING MIGRATIONS. IF YOU NEED TO ADJUST THE SCHEMA, ADD A NEW MIGRATION. @@ -627,4 +627,15 @@ export class PostgresAccountDB implements AccountDB { ` ] } + + private getV2Migration (): [string, string] { + return [ + 'account_db_v2_fix_workspace', + ` + + /* ======= WORKSPACE ======= */ + ALTER TABLE workspace ALTER COLUMN "versionPatch" type INT4; + ` + ] + } } diff --git a/server/client/src/account.ts b/server/client/src/account.ts index b73dfe448a..9daf7c7c36 100644 --- a/server/client/src/account.ts +++ b/server/client/src/account.ts @@ -138,7 +138,15 @@ export function withRetryConnUntilTimeout

( export function withRetryConnUntilSuccess

( f: (...params: P) => Promise ): (...params: P) => Promise { - const shouldFail = (err: any): boolean => err?.cause?.code !== 'ECONNRESET' && err?.cause?.code !== 'ECONNREFUSED' + const shouldFail = (err: any): boolean => { + const res = err?.cause?.code !== 'ECONNRESET' && err?.cause?.code !== 'ECONNREFUSED' + + if (res) { + console.error('Failing withRetryConnUntilSuccess with error cause:', err?.cause) + } + + return res + } return withRetry(f, shouldFail) }