I've been working on this library for 2-3 months now, if somebody gives it a try let me know how it goes :)
I'd be happy to answer any questions as well.
I've been working on this library for 2-3 months now, if somebody gives it a try let me know how it goes :)
I'd be happy to answer any questions as well.
Following your example, let's say that most customers have multiple departments and that most tables have both a customer_id and a department_id.
Oh, and this looks solid. Nice work :)
You could probably do it nonetheless with Rails' own has_many/belongs_to relationships for that sub-tenant, but the automatic adding of department_id into queries wouldn't happen.
Depending on what storage you end up using, that might matter or not. For example with Citus, you'd typically take the top-level tenant (customer_id) as a shard key, and just have all the departments of that tenant on the same node - so it would work fine.