Here we have a fake company, a Blood Bank. The core idea is that only donors can donate blood but cannot log into the system. However, a "registered user" (rows in the user
table) that represents a company can log into the system and see the amount of blood that their company has donated. Donors must be connected to companies. In a fringe case, a "registered user" can also donate blood.
- User = A "registered user". Can log in.
- Donor = Cannot log in.
- Admin = A site administrators. Can log in.
- Blood bank employee = Self explanatory. Can log in.
There might be other types of users in the future, like differentiating types of "registered users". Maybe, just maybe.
SOLUTION 1
- Separate donor table.
PROS:
- Queries to find donors will be faster, especially if the table grows large
CONS:
- What to do if a donor suddenly wants to log in? Create a duplicate entry in the
user
table? - What if a "registered user" wants to donate? Create a duplicate entry in the
donor
table?
SOLUTION 2
Use ACL role
/user_role
tables to define donors (and other user types)
PROS:
- Easy to handle a donor that wants to later login as a "registered user"
- Easy to handle a "registered user" that later wants to become a donor
- Also easier to promote any user to an admin
CONS:
- There are fields that donors do not need, like 'password', 'throttled', so There will be extra NULLs
SOLUTION 3
Identical to Solution 2, except creating an additional table user_type
. This would be done to avoid re-using the ACL system for controlling log in & user account type details.
SOLUTION 4
Aggregate user.
This is based on user1759572's suggestion to use an aggregate user. I may not have modeled it exactly right.
Which option would you go with? Is there a 4th.. 5th option.. something better?
Any reply is very much appreciated. This will help me nail down a final bit of design that I've been bouncing around on for a few days now. Arg. Thanks you SO!