I'm in the process of building a new system which will require an extendable data model. It's quite complex, but the part of the system which requires this structure is very relatable to the product part of an ecommerce system, so I'll use that as a case.
Imagine a set of companies. Each company has a range of products, which has some basic attributes such as name
, sku
, description
, price
etc. Alongside these basic attributes, the company should be able to create n
custom product attributes, which belongs to the company (i.e. Foo Corp. shouldn't be able to see Acme Inc.'s custom attributes). Beside that, each company should be able to translate these attributes for each product; so each custom attribute value is basically constructed from an attribute
, a product
, language
and a value
.
I do understand that the EAV structure is an anti-pattern if you store an fixed amount of attributes and the one in need of extending the amount of attributes isn't the owner of the system.
So my question is - how would you achieve this? It the EAV structure really an anti pattern in this case? Magento is a classic example of someone using this design, and it kinda seems like they built a monster and had to 'fix' it by implementing flat index tables. But are there any other database design pattern that allows for this amount of flexibility?