Prior to this commit, the upsert did not take into account the dates and systematically
overwrote previous inputs.
This now tries to update only when the provided date (per event) are most
recent (events: eventful, uneventful, failed).
The last_snapshot entry is then only updated when the `last_eventful` date is most
recent then the one currently stored.
Related to T2967
Depends on D4853