I want to store certain items in the database with variable amount of properties.
For example:
An item can have ‘url’ and ‘pdf’ property both others do not en instead have ‘image’ and ‘location’ properties.
So the problem is an some items can have some properties and others a lot.
How would you design this database. How to make it searchable and performant?
What would the schema look like?
Thanks!
What you are after has a name – Entity Attribute Value (EAV). It is ‘a data model that is used in circumstances where the number of attributes (properties, parameters) that can be used to describe a thing (an ‘entity’ or ‘object’) is potentially very vast, but the number that will actually apply to a given entity is relatively modest.’