0

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:

enter image description here

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.

Sumit Wadhwa
  • 2,825
  • 1
  • 20
  • 34
  • 2
    It probably depends on your business case, and the specific problem or set of problems your actually trying to solve. I don't think there's enough information here to elaborate further. – Strawberry Feb 29 '20 at 08:48
  • This is about DB subtyping/inheritance. (You have different (sub)types of personnel.) This is a faq. Before considering posting please always google any error message or many clear, concise & precise phrasings of your question/problem/goal, with & without your particular strings/names & site:stackoverflow.com & tags; read many answers. If you post a question, use one phrasing as title. See [ask] & the voting arrow mouseover texts. (But we can't tell you what is "best". [Strategy for “Which is better” questions](https://meta.stackexchange.com/q/204461)) – philipxy Feb 29 '20 at 17:40
  • Time to follow a published academic textbook on information modelling, the relational model & DB design & querying. (Manuals for languages & tools to record & use designs are not such textbooks.) (Nor are wiki articles or web posts.) Dozens of published academic information modeling & DB design textbooks are online free in pdf. stanford.edu has a free online course. (But asking for resources outside SO is off-topic.) PS Don't ask us to rewrite a textbook with a bespoke tutorial. Follow one & ask 1 clear specific non-duplicate question about where you are 1st stuck. – philipxy Feb 29 '20 at 17:43
  • @philipxy I guess I didn't know the "precise phrase" before I'd put up this question, but thanks for the link – Sumit Wadhwa Feb 29 '20 at 19:11
  • By "precise" I mean, neither general or vague. I don't mean that you are supposed to know a particular way of phrasing your problem. I clearly say to use many ways, expecting always many reasonable ways. PS I don't even know what you are trying to say by either of "separate tables for each of these capacities" or "create another capacity table". The former seems to have something to do with subtyping, the latter something to do replacing values by other values that are somehow more id-ish (yet another faq, with no "best"). So the post is unclear & it's not clear what your question even is. – philipxy Feb 29 '20 at 19:21

0 Answers0