MODOAIPMH-25: Deleted records support
Currently the FOLIO repository doesn’t support deleted records due to impossibility of deleting MARC records via the user interface. However, as Inventory records are going to be considered and holdings with items will be included into the OAI-PMH feed, FOLIO should allow configuration of transient and persistent deletion support as well to let Discovery Systems know when the holding/item record is removed from the repository.
In other words, the inventory API needs to have an ability to allow searching for deleted instances, holdings and items within a given timeframe.
The following solutions are to be considered:
Implement soft delete in instances, holdings and items in inventory
Option 1
Add a column to store the deleted date. Introduce a view to filter records that have the deleted date populated. In /delete API, populate the deleted date, do not remove the row.
Alternative #1:
In order to not inroduce breaking changes to the code, rename the tables and create views with same name.
Alternative #2:
Do not rename tables, update the existing code in inventory-storage to select from view.
Pros:
- This makes it very easy for mod-oai-pmh to retrive the needed information as all the records are stored in same tables as before.
- No impact on code, just need to add a new API to retrieve the data from the table.
- Easy to implement "undelete" functionality if it will be needed.
Cons:
- Cons: limited support of views in RMB.
Option 2:
Use "withAuditing" in schema.json. This will create a separate table that will be populated by trigger when a record is deleted
Pros:
- No code changes.
Cons:
- Performance impact due to usage of a trigger.
Messaging
Approach: send a message on any operations with instances, holdings, items. Comsume it in mod-oai-pmh and update the module-local storage with pre-generated data.
Pros:
- Potentially the best performance, as the module will have all the data in its own storage.
Cons:
- Need to access the possibility of using kafka directly or resort to mod-pub-sub (which is undesirable as of now)
- introduction of a new storage, which will require maintanace.
- increased complexity.