Open NielsKSchjoedt opened 4 years ago
The research that I have done seems to indicate that use_schemas
is incompatible with with_multi_server_setup
There is a note about it in this issue: https://github.com/influitive/apartment/issues/596, but I also went and traced through the code and found that use_schemas
causes use of a different postgres adapter, which overrides the connect_to_new
method.
I am in the same situation as you, and it is imparitive that my organization finds a solution to this issue. I will report back when I find a work around.
In the mean time, can we get some input from the maintainer ( @mikecmpbll ) about this issue?
I'm new here please help
To run correctly
Database: (Tell us what database and its version you use.) postgres 15
Apartment version:
Apartment config (in config/initializers/apartment.rb
or so):
require 'apartment/elevators/host'
Apartment.configure do |config|
end
Rails.application.config.middleware.use Apartment::Elevators::Host
* `use_schemas`: (`true` or `false`)
* Rails (or ActiveRecord) version:7.0.8
* Ruby version: 3.2.2
I have an application that has been running with apartment with postgresql adapter in
use_schemas
-mode and it's been working for years. By tenants are based on country, splitting my application by country.In order to scale the application we need to start splitting the database into multiple hosts (physical servers). I am trying to make this work using apartment, but so far it fails. I have an apartment config like this:
My database.yml looks like this:
Now when I try to do Apartment.switch!('de') I get:
Why is this happening? Is there something I have overlooked?