3 ms·
I’ve used the EAV pattern to allow users to add “custom fields” to an object. The application has Person objects, who work for a Department. Lets say one depar
by antsar 8y ago
I’ve used the EAV pattern to allow users to add “custom fields” to an object.
The application has Person objects, who work for a Department. Lets say one department wants to record their employees’ shirt size, while another department wants to record their employees’ favorite color. Then, next week, they decide to also track their favorite brand of beer.
EAV allows department administrators to set this up on-the-fly without any development or database migrations.
Another way to tackle the same problem (used by Drupal, for example) is to actually modify the database schema at runtime, creating/modifying tables whenever your users want to change how the application behaves.