Dynamic Custom Fields for Data Model
- by Jerry Deng
I am in the process of creating a dynamic database where user will be able to create resource type where he/she can add custom fields (multiple texts, strings, and files)
Each resource type will have the ability to display, import, export its data;
I've been thinking about it and here are my approaches. I would love to hear what do you guys think.
Ideas:
just hashing all the custom data in a data field (pro: writing is easier, con: reading back out may be harder);
children fields (the model will have multiple fields of strings, fields of text, and fields for file path);
fixed number of custom fields in the same table with a key mapping data hash stored in the same row;
Non-SQL approach, but then the problem would be generating/changing models on the fly to work with different custom fields;