You must avoid DB history changes as much as possible.
If you found a critical issue and old data calculated wrong you need to recalculate it.
You must done all steps in the same sequence!
In the parser tools you can find a lot examples.
Be sure that recalculated data is correct. Make unit tests. Look at data from UI.
Deploy bug fix on stage. At this moment data should be calculated correctly and history data should look with a gap. It is normal. Check data in DB and from UI.
After deploy create a dump. The data will include wrong period and a bit data with correct totals.
Install the dump on the DB where you will do recalculation.
...
Create a file with queries that update only necessary data.
...
Also stop ethparser-api