Answer the question
In order to leave comments, you need to log in
How to implement a model of many types in one?
Let's say we have a User table. It has generic fields for the user. But users can be n different types. But only 1 of them. Each type includes custom fields set for that type. What is the best way to organize this model?
Example. Any user has fields: id, name, email, type. But depending on the type, it may have an additional set of parameters. If the user is of type simple, then he also has field1 and field2, and if he is of type business, then field3 and field4. That is, the set of additional fields for each type is different.
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question