I have a table I want to load once right after Nest starts and the database is connected
I can't seem to find an event for TypeORM for db - is Connected, and when I try
getConnection
I get a warning, and right now I solved this in a poor timeout po
const f = () => {
const con = getConnection();
if (con.isConnected) {
console.log('connected');
// this is where the table load will take place
} else {
console.error('not connected');
setTimeout(() => {
f();
}, 200);
}
};
f();
that results in "ConnectionNotFoundError: Connection "default" was not found."
so I wonder if there's anyway around it ?