Prajjwal Gupta

Joined

710 Experience
7 Lessons Completed
0 Questions Solved

Activity

Posted in Multitenancy with the Apartment gem Discussion

Hi Chris,
Thank you for the insightful explanation. I have a few follow-up questions regarding our multi-tenant setup:

Since the tenant context is determined via Kafka events (using tenant_id) and not based on URL/subdomain, should we still use the gem in this setup?
Currently, we switch the tenant context using: ActiveRecord::Base.connection.execute("SET search_path TO #{tenant_id}")
and run migrations via: ActiveRecord::MigrationContext.new("db/migrate").migrate
While we don’t require shared tables in the public schema at the moment, how can we manage migrations separately for tenant schemas and public tables in the future?
Looking forward to your guidance.