Shared Database
Design of database tables
When using the shared database mode, by default, entities are not isolated by tenant. This means that all tenants will see all the data stored for this entity. This is useful, for example, when you have a Country entity that will contain the same list of countries no matter who the tenant is.
However, if you want data related to an entity to be isolated by tenant, you must check the Multi-tenant in shared base checkbox in the properties of the data table linked to the entity in Neos Studio.
Multi-tenant table
When a data table has the Multi-tenant in shared base property checked, the migration will automatically create the database elements required for isolating data by tenant :
- New
TenantIdcolumn (Integer, Required) in the table - New index on the
TenantIdcolumn in the table - Addition of the
TenantIdcolumn on the other indexes referencing the table
Warning
Only tables with a single-column primary key of type AutoIncrement or Guid can be multi-tenant.