Best approach to Database relation in many levels


I have a question about the best approach to this Scenario.

In Admin Screen, user can edit the Template. And the Template has the below relation.

He can edit (text,detail,item,etc...), add , delete, edit.

And at the User Screen. The user will select this options in dropdowns or lists, that have the relation, like below:

So, is it better do transform Template from admin in a JSON and read it everytime user focus input?

Or load the template in 4 Entities, and connect to the user screen?

The model below is right? And where is it correct to put the date of the user selection, or if need to use a picture/attachment. Inside each entity (item, subitem....) or inside the connector (grouptextdetailitemsubitem entity) ?

I really appreciate any insights!


Hello Luan,

I would go for entities over JSON, if that's the full depth of your tree. Going to JSON would require you to convert back and forward, and you'd still need to define structures to deal with it.

Regarding the model, I may be missing something, but this would be my approach:

(It might make sense to de-normalize, depending on usage)

For the pictures, we recommend that you store them in a separate table, for performance reasons. But again, depends a bit on the scenario.

Hope this helps!