3 ms·
> Take for example the Danish CPR number. That's perfectly fine as a natural key; its definition is the first CPR number assigned. The problem is that the new
by crote 2y ago
> Take for example the Danish CPR number. That's perfectly fine as a natural key; its definition is the first CPR number assigned.
The problem is that the new CPR number is now the one you want to use for all display purposes and future interactions with external systems. In other words, you can't use the "original CPR" field for anything except as key. It's no longer a CPR field, because it no longer has any relation to the person's CPR!
And at that point it'd be better to just use a GUID or something as key and avoid any potential confusion between the "real" CPR and "fake" CPR, because when the two are the same 99% of the time it is guaranteed to cause a shitton of bugs.
The only solution is to essentially rewrite all your records with the new CPR as key, and leave a redirect entry at the old CPR. That's pretty much what happens in Sweden when you change your gender: your old identity ceases to be and you're issued a completely new one.