Hi,
Just looking for some opinions/ideas on how best to do this.
I'm building an extranet system where users are added by the administrators manually (there's no ability for someone to "register" themselves). When they're added only a small amount of mandatory data is entered (name, email, password), they are then emailed their login, and when they first access the system they are asked for additional mandatory details that must be completed before being given access to the full site.
I can think of three ways to define this in the DB:
Set all mandatory fields to NOT NULL in the DB, and enter empty strings for all the "conditionally mandatory" fields when creating the user (I don't like this, seems hacky)
Set only the initial mandatory fields to NOT NULL in the DB, and enter NULL for all the "conditionally mandatory" fields when creating the user (I don't like this, while technically correct, the schema wouldn't reflect the real world user entity, where all the data is mandatory)
Have two tables, one for new users, and one for complete users (at first glance this seems to be the best option, however other tables need to have relationships that point to the user table, and this would complicate that/make it impossible)
Any thoughts?
Cheers,
Jack
Edit
So looks like number 2 would be the best approach, with a field that defines the status of the record (new/complete) and either check constraints or a trigger to check whether or not all the "optionally mandatory" fields have a value. I'm guessing check constraints would be the most suitable option, but I'll give both a go and see which works best. Thanks.