kufu / activerecord-tenant-level-security

An Active Record extension for Multitenancy with PostgreSQL Row Level Security
MIT License
45 stars 9 forks source link

Enable support for custom column names for tenant-level security policies #22

Closed shimx closed 3 months ago

shimx commented 4 months ago

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 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

shimx commented 4 months ago

In addition, the following modifications were made: