A
A
Arman2017-08-12 10:37:37
MySQL
Arman, 2017-08-12 10:37:37

Whether it is necessary to carry away optional things in one serialized field of a DB?

All the time I decided in different ways, I decided to clarify how it would be better and more practical to be with optional recording things. Suppose there is a News model, each entry of this model can have some options that are specified by the admin panel, for example, how and where to show on the main page, block background colors, etc. For each option, adding a bunch of fields to the model / database is expensive, although it needs to be shown in separate fields in the admin panel, I thought maybe add one Record Options field and store such things serialized there? when asked, wrap in which class the News Options and I will play with them as if I pulled them out of the links.
In general, on the one hand, a bunch of separate fields in the database, on the other, one serialized field. Well, or can, again, a separate model / table with options, which can be obtained through links?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
0
0xD34F, 2017-08-12
@Arik

Quite possibly, why not? You can store these settings as a json object.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question