Every tutorial I ve seen about Multitenant database models tells you to put the TenantID in every single table:
zoos
-------
id
zoo_name
tenant_id
animals
-------
id
zoo_id
animal_name
tenant_id
However, this seems redundant to me. Why not add the tenant_id
column to just the zoos
table and exploit the foreign key relationship between zoos
and animals
?
Do you add tenant_id
to every table just to keep the joins from getting too crazy? Is it a safeguard against bugs? A performance consideration?