Skip to content

Commit

Permalink
Fix connectors DB migrations (#6326)
Browse files Browse the repository at this point in the history
  • Loading branch information
flvndvd authored Jul 18, 2024
1 parent 6e2a3b2 commit 33fbdc3
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion connectors/src/resources/storage/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,20 @@ 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(),
{
pool: {
// Default is 5.
max: isDevelopment() ? 5 : 10,
},
logging: false,
logging: isDevelopment() && DB_LOGGING_ENABLED ? sequelizeLogger : false,
hooks: {
beforePoolAcquire: (options) => {
acquireAttempts.set(options, Date.now());
Expand Down

0 comments on commit 33fbdc3

Please sign in to comment.