For my Vapor project, I want to mostly use a single Postgres database. However, for certain long-running requests, I want to use a separate, read-only clone of the same database.
The documentation for this is very sparse. How do I add another database connection next to the existing default database?
static func configureDatabase(_ app: Application) throws {
try app.databases.use(.postgres(url: "postgresql://user@localhost:5432/user"), as: .psql)
}
When running queries, how do I tell Fluent to run those queries on the second database?