Hello. I had the following situation. There is a project, in it, by itself, there are classes representing tables from the database (entity). Now for all users the same functionality is presented, but in the future it is possible for individual users to modify the functionality. And if the business logic is quite simple: you can simply connect the necessary managers, etc. But then there are difficulties with storing some additional data, because there are many such modifications and if you make your own field for each (for example, modifies the user class and adds the fields "preference", "interests", etc.), then the tables will undress to huge sizes. Actually, the idea is this: in each table to make the field "modifications" and there in json format to write data that will already be dealt with by business logic.

That's just storing json in the database sounds like a crutch (What are the options in general?

  • For example Entity – attribute – value model en.wikipedia.org/wiki/… - Sergey
  • @Sergey, did not have time to issue) - Mikhail Rebrov
  • Many keep json in the database and see nothing wrong with that. Moreover, the main DBMSs already support json natively and allow all sly operations to be performed on it - andreymal
  • It is not a shame to keep JSON in the database, but the question is whether you need to work with these values ​​of characteristics or not. If you need to select entities with a certain value of a certain property, then JSON does not really rule here if we are not talking about databases that can work with it. - Mikhail Rebrov

1 answer 1

As an option EAV pattern or Entity-Attribute-Value


  • Store entities in one table
  • In another table, keep a list of additional characteristics.
  • In the third of their values, referring to the necessary entity and the necessary characteristics

enter image description here