Database connections should not be opened during routes loading

Problem

Opening database connections during routes loading, or any initializer means that Rake tasks cannot be run in a node that does not have database setup

To work-around this, we closed all connections after routes re-loading - !85006 (merged).

Proposal

We still need a longer-term fix:

  1. Detect, and warn database connections that are opened during routes loading
  2. Fix to not open these database connections. Alternatively, don't even autoload these constants => !92075 (merged)

Related links

Edited by Thong Kuah