From 33fbdc399e89088ce96b1636e356a37b3a303b2c Mon Sep 17 00:00:00 2001 From: Flavien David Date: Thu, 18 Jul 2024 22:57:44 +0200 Subject: [PATCH] Fix connectors DB migrations (#6326) --- connectors/src/resources/storage/index.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/connectors/src/resources/storage/index.ts b/connectors/src/resources/storage/index.ts index d6009e50dc87..84ef9946498d 100644 --- a/connectors/src/resources/storage/index.ts +++ b/connectors/src/resources/storage/index.ts @@ -6,6 +6,12 @@ import { dbConfig } from "@connectors/resources/storage/config"; const acquireAttempts = new WeakMap(); +const { DB_LOGGING_ENABLED = false } = process.env; + +function sequelizeLogger(message: string) { + console.log(message.replace("Executing (default): ", "")); +} + export const sequelizeConnection = new Sequelize( dbConfig.getRequiredDatabaseURI(), { @@ -13,7 +19,7 @@ export const sequelizeConnection = new Sequelize( // Default is 5. max: isDevelopment() ? 5 : 10, }, - logging: false, + logging: isDevelopment() && DB_LOGGING_ENABLED ? sequelizeLogger : false, hooks: { beforePoolAcquire: (options) => { acquireAttempts.set(options, Date.now());