I hear your points. It’s possible the database just doesn’t show it in the interface because it can’t find the record. I will do some testing right now and report back.
I created a transaction with a tracking code in my Northwind sample database:
"Payer": "B's Beverages"
After deleting that tracking code, the TrackingCode ID remains in place for that transaction record.
The interface shows it as missing, as you said, but it’s really actually still there behind the scenes:
Luckily, even editing that transaction and saving it doesn’t override the TrackingCode ID!
So the data can be recovered as I thought. A new tracking code needs to be created with the same UUID as the old one. As long as the new tracking code uses the same UUID as the old one, it will work fine.
The only issue is that @lubos will likely need to make this fix, since there is of course no way to define that internal UUID using the interface.
@raJ - I highly recommend you create a backup immediately, just in case. The one thing that likely will erase the ID is if you manually update that specific tracking code field. Updating other fields (e.g. Payer / Description) seems to be OK.