How execute a command on each Sequelize connection?

Viewed 135

I need to set a Mysql session variable (aurora_replica_read_consistency) on each Sequelize connection for my nodejs application.

I can set this session variable with the below code, but I'm pretty sure this won't be set for all Sequelize connections, that I need a way of setting this each time a new DB connection is opened/added to the connection pool.

await sequelize.query("set aurora_replica_read_consistency = 'eventual'");

Is there a way to configure this session variable on my Sequeilize instance, or to extend/override Sequelize such that I can set this each time a new connection is created?

0 Answers
Related