0

I have a stream replication db running and I would like to change the connection to it when the main db fail.

I have set up the connection for both dbs on config/database.ts and tried to use the connection menager event as in adonis docs :

Doc example:

import Database from "@ioc:Adonis/Lucid/Database";

Database.manager.on('db:connection:error', (connection) => {
  console.log(self === connection) // true
})

I tried to use it on start/events.ts but it doesn't recognize the 'on' method.

Property 'on' does not exist on type 'ConnectionManagerContract'

Any idea on how to make this work? Thanks.

jean.b
  • 13
  • 3

0 Answers0