I have a Boolean field in a job table called external. If it's true then the job is external and if it's false then it's internal, obviously.
If the job is external then it needs to store an ID that refers to a record in a client table, and if it's internal then it needs to store an ID that refers to a record in a staff table.
I will need the user to select whether the job is internal or external, potentially before they even know the client or staff to select. So I can't just do away with the external field, though I'm not sure if that would be a good or bad idea anyway.
It makes sense to me on the surface at least to just use one field that stores either ID rather than having two fields when only one will store data and the other will be Null. It's an ID so it's not like the datatype will need to be changed and not match in the future.
Is there any problems this could cause and is it bad practice for some reason? Because I have a feeling it could very well be.
I'm using Firestore with Flutter but I think this question is relevant to databases in general.