I'm struggling in database design problem and it seems I can't get it out properly.
I need some help on this. Maybe it's a dumb case but I'd like to validate or correct my scheme and then go ahead.
The app should behave like this:
- a user can be part of multiple accounts and have different roles (admin or not)
- an account can have one or many groups
- each group can have one or many members
- a member can be part of many groups
a member can be either an user or a legal entity (company)
if it's a company, then the company is represented by a user
- a user can represent 0,1 or many companies in different groups
Here in GroupMembers, the users_id or companies _id will be filled either it's a legal entity or individual.
And the CompanyRepresentedBy table will contain the group_id, user_id and company_id
I'm not really sure of this scheme.
Thank you all!
PS: I can provide the MySQL Workbench file if needed