Answer the question
In order to leave comments, you need to log in
How to make storage of dynamic values ​​thembehind EAV?
Hello,
Recently I was asked for help with a store built in Laravel. The essence of the problem is that the product range is constantly updated and new, not provided, values ​​​​for the current characteristics appear. For example, for the characteristic "upholstery", there were values ​​"leather, jacquard", and now "silk" has also appeared. Now all this is implemented through a config file, and as a programmer I really like everything, I wouldn’t change anything at all, the previous developer did everything well. Just take and add the value to the config and that's it. But the customer does not like that he constantly depends on that person and he wants to independently change these values ​​​​through the admin panel.
So now I'm sitting and thinking how this can be done, so that without hemorrhoids? I once participated in a project where they decided to use the EAV model, but it was a mistake. In my opinion, doing this is not fast, it is difficult to maintain and it takes a very long time to wait for requests from the database. In the following projects, we solved similar problems by choosing a DBMS. Well, comfortably and quickly, this was done on mongoDB or postgreSQL with their hstore.
Now this is a ready-made store using mysql, and a small budget was given to the task, and there can be no talk of changing the DBMS or serious refactoring. The only thing I came up with was to store dynamic values ​​in a json field in a separate table, in the form {latin_key=>'cyrillic value'}, and store latin_key for the product itself.
Can anyone suggest a suitable solution?
Thank you.
Answer the question
In order to leave comments, you need to log in
I remember once in one company I had a test task to read arrays and display all their values ​​in the form of a form, respectively, when the form is saved, its values ​​\u200b\u200bare added / edited / deleted, the complexity can only be with the keys stored in the database (in the case when fields are swapped, etc.). Try to search on the github for similar solutions, at least it fits into your "cheaper and faster" solution. :)
mysql has supported json recently and xml has been supporting for a very long time https://dev.mysql.com/doc/refman/5.7/en/xml-functi...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question