Answer the question
In order to leave comments, you need to log in
How to store categories of different entities in the database?
Good afternoon. I have the entities "device" and "spare part" in the database. It is not possible to combine them into one "object" (because they have different business logic). However, it is necessary to categorize both of these entities. What is the right thing to do: store catalog categories in one table (adding a column linking the entity and the category) or make 2 identical tables for 2 different entities?
Answer the question
In order to leave comments, you need to log in
if an entity can have only 1 category, then you can store it in 1 table,
if there are several, then either make 2 tables or 1 intermediate one in which there will be 3 fields, category id, entity id and entity type (device or spare part)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question