table inheritance: TPH, TPT and single table vs taxonomies
0
votes
1
answer
135
views
according to this post and many others web resources, you can do table inheritance with
Table Per Hierarchy Inheritance
, Table Per Type Inheritance
or Single table
(single table for all sub classes).
What about taxonomies? I do not know if "taxonomy" is the right word, I try to explain.
I have 3 entities type:
- Organization (father)
- Restaurant (child)
- Hotel (child)
These are the tables I thought:
organization_type (id, name) // (ex. "restaurant", "hotel")
organization (id, name, organization_type_id)
organization_taxonomy (id, name) // (ex. "rooms_number", "tables_number")
organization_has_taxonomy (organization_id, organization_taxonomy_id, value)
If I need another organization type, I just need to:
1. add record to organization_type
table
2. add records to organization_taxonomy
table
Are there some drawbacks in this approach I am not thinking about?
Asked by Giacomo M
(163 rep)
Feb 19, 2023, 07:22 AM
Last activity: Feb 19, 2023, 02:18 PM
Last activity: Feb 19, 2023, 02:18 PM