custom_field_values
rather than a single text column. This eliminates costly type conversions, enables native database sorting/filtering, and maintains data integrity through database-level constraints. When you store an integer, it’s actually stored as an integer—not a string that needs parsing.
Product
, User
, Order
—anything implementing the HasCustomFields
interface.
Multi-Tenant Isolation: Optional tenant awareness is built into the core schema, not bolted on later. When enabled, all data is automatically isolated between tenants while maintaining query performance.
Extensible Field Types: Field types are pluggable through a clean interface. The settings
JSON column provides unlimited extension points without schema changes.
Efficient Querying: Unlike traditional EAV models, this design supports efficient filtering and sorting on custom field values using native database types and proper indexing strategies.
tenant_id
is included in all unique constraints and automatically filtered through model scopes. This ensures complete data isolation while maintaining query performance through proper indexing.