I am trying to model a database consisting of different entities that need to be authenticated through a login system. Let's assume to have two separate entities (Seller and Manager) just like this image:
as you can see both of them have (only) one account identified by the primary key username. I would like to be able to identify one role by its username, so that my system recognises what to do. If we translate this conceptual model in the physical one the resulting model is the following:
Is this actually correct?
Update:
I translated in english all my entities and decided to upload my physical model here in order to explain why i made this user-centric:
My users are:
- SystemAdministrator
- Owner
- Seller
basically these three roles have logical connection with other entities, how can i keep these logical connections and still have a valid account table (for username, password… info)?
Thanks in advance and best regards.
Best Answer
I don't think you should make tables to represent Roles (User, Manager, Seller, etc) I think you could implement something more scalable like this:
Completely forget about the "user-centric" model and think to a lower level, Individuals. Individuals can have any number of Accounts and Accounts can have any number of Roles. Individuals can be represented on any number of abstractions around the database or even across databases.
What do you think?