This pull request introduces the ability to specify custom column names for tenant-level security policies within the TenantLevelSecurity::SchemaStatements module.
The need for this enhancement is due to potential conflicts with existing tenant_id columns in some applications.
For example, a real estate service may already have a tenant table that uses the tenant_id column in a different context.
I'm leaving the default column name as tenant_id to maintain compatibility with the standard approach of multi-tenant architecture.
I also made sure that the tenant_level_security.tenant_id setting remains unchanged to maintain the consistency and intent behind the design principles of multi-tenant architecture.
Key changes
Added an optional column_name parameter to the create_policy method to allow developers to specify a custom column name for tenant identification.
Description
This pull request introduces the ability to specify custom column names for tenant-level security policies within the
TenantLevelSecurity::SchemaStatements
module.The need for this enhancement is due to potential conflicts with existing
tenant_id
columns in some applications.For example, a real estate service may already have a tenant table that uses the
tenant_id
column in a different context.I'm leaving the default column name as
tenant_id
to maintain compatibility with the standard approach of multi-tenant architecture. I also made sure that thetenant_level_security.tenant_id
setting remains unchanged to maintain the consistency and intent behind the design principles of multi-tenant architecture.Key changes
column_name
parameter to thecreate_policy
method to allow developers to specify a custom column name for tenant identification.