Closed TheMasterCado closed 5 years ago
@mikecmpbll I saw that you're now a collaborator (#591 ) for that project because you're a big user of it (your company). I'm in a similar situation here and wanted to see what your intentions are with it. Maybe your changes could help us with our problem or you may already know how to solve it. Thank you!
I was having a similar issue, and I found that 'use_schemas' had to be set to false in order for the multi server setup to work ('config.with_multi_server_setup = true').
Steps to reproduce
Setup Apartment to use multiple servers and create a tenant in a distant server, not the one in database.yml. Add a migration and run
rake db:migrate
.Expected behavior
Apartment connect to each tenant from their db_configuration and run the migrations on them.
Actual behavior
Apartment cannot find the distant schemas and migrate only the schema on the server specified in database.yml.
System configuration
Simple Linux Mint VM for development and a second VM to run a second PostgreSQL instance.
Database: PostgreSQL 10.6
Apartment version: 2.2.0
Apartment config (in
config/initializers/apartment.rb
or so):require 'apartment/elevators/subdomain'
#
Apartment Configuration
# Apartment.configure do |config| config.excluded_models = %w{ Tenant Delayed::Job } config.with_multi_server_setup = true
config.default_schema = "public" config.tenant_names = lambda do Tenant.all.each_with_object({}) do |tenant, hash| hash[tenant.subdomain] = tenant.db_configuration end end end
Rails.application.config.middleware.use Apartment::Elevators::Subdomain