Using multiple databased in Rails 6 for schema-based multitenancy

I’m curious if the core team would consider as an intended use case or if anyone has successfully implemented multi-database configuration to implement postgres-schema-based, subdomain-driven multitenancy. I would love if a database.yml like the following…

production_default: &production_default

<<: *default

database: my_app_production

migrations_paths: db/tenants



<<: *production_default

schema_search_path: public,extensions,tenant_1


<<: *production_default

schema_search_path: public,extensions,tenant_2


…could properly set the appropriate connection with some connection-switching glue code.

I would love to move away from directly manipulating the schema_search_path from app code and overloading databases.rake tasks, but in my brief spike on using multi-database configuration as a trojan horse for multi-schema configuration, I got the sense I was headed towards pain.