3 ms·
Does this have easy support for some kind of sub-tenant setup? Following your example, let's say that most customers have multiple departments and that most ta
by jaxn 10y ago
Does this have easy support for some kind of sub-tenant setup?
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 :)
- lfittl 10y agoThats a good question - there is nothing explicit for it, yet. 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.