Overview
In the actual database, when an Instrument is deleted, it cascades and will be removed from linked objects such as DOIs. However, the draft for the DOI will still contain the instrument, and the cascade is not reflected there.
Because the CMR update process relies on drafts, when it detects that it needs to push an update to a DOI, it will include the now deleted instrument with the update. This update will fail, because the instrument has been deleted.
System-Wide Long-term solution
Draft Cascading
When cascade deletes happen in the system, auto-published drafts should be made to remove these objects. So, if an instrument is deleted and a cascade is required to remove it from a DOI, then an update draft removing that instrument from the DOI should be automatically created and published.
Draft fixing
The existing database does not contain this history of drafts. We would need to figure out a way to retroactively represent these cascades in our drafts.
CMR Update Short-term solution
Before the cmr updater publishes a doi update, it should double check all its campaigns, platforms, instruments, and flights to ensure that they still exist.
### Tasks
- [ ] https://github.com/NASA-IMPACT/admg-backend/issues/519
Overview
In the actual database, when an Instrument is deleted, it cascades and will be removed from linked objects such as DOIs. However, the draft for the DOI will still contain the instrument, and the cascade is not reflected there.
Because the CMR update process relies on drafts, when it detects that it needs to push an update to a DOI, it will include the now deleted instrument with the update. This update will fail, because the instrument has been deleted.
System-Wide Long-term solution
Draft Cascading
When cascade deletes happen in the system, auto-published drafts should be made to remove these objects. So, if an instrument is deleted and a cascade is required to remove it from a DOI, then an update draft removing that instrument from the DOI should be automatically created and published.
Draft fixing
The existing database does not contain this history of drafts. We would need to figure out a way to retroactively represent these cascades in our drafts.
CMR Update Short-term solution
Before the cmr updater publishes a doi update, it should double check all its campaigns, platforms, instruments, and flights to ensure that they still exist.