2 ms·
How is this different from existing multitenacy gems like `apartment`?
by mperham 10y ago
How is this different from existing multitenacy gems like `apartment`?
- lfittl 10y agoLet me start by saying that apartment is great - but it takes a different approach. The most important difference is that apartment shards by database or schema, vs activerecord-multi-tenant puts all your data into the same table, and then relies on a PostgreSQL extension like Citus to do the distribution. There is trade-offs to both, but part of the reason we prefer the latter approach is that schema changes become a lot easier, and you can do shard-splitting based on a shard count, as opposed to just by tenant, effectively grouping smaller tenants together on a node. I'll also give a shout-out to acts_as_tenant, which our library is based on, although we've deviated a bit since then.