I'm working on an app that has mainly two entities: Company
and User
. A User
can be an employee
, owner
, or a partner
.
My current approach of modelling this is:
Capacity is enum with possible values: employee, owner, partner
Someone got me confused suggesting I should have three separate tables for each of these capacities, which I don't think is right.
I'm terribly unsure whether the capacity could grow to more in future.
Should I create another capacity table and reference it in Personnel as a foreign key, in case we wish to add more capacity? Would that be a scalable (and right) approach?
Thank you.
Best Answer
I would not have separate tables but you might want to consider not using
enum
for the capacity column.Instead use a table named, perhaps,
capacity
that has an id referenced in thepersonnel
table (much like user ID and company ID). That makes it trivial to add new titles/positions without disturbing anything else.