What is the best way to restore(rollback) data in an application to a specified state(date) ?
Posted
by panzerschreck
on Stack Overflow
See other posts from Stack Overflow
or by panzerschreck
Published on 2010-05-19T15:34:53Z
Indexed on
2010/05/19
20:00 UTC
Read the original article
Hit count: 196
Hello,
An example would set the context right, the example below captures the various states of the entity, which needs to be reverted(rolled back) .
State 1 - Recorded on 01-Mar-2010
Column1 Column2
Data1 0.56
State 2 - Recorded on 02-Mar-2010
Column1 Column2
Data1 0.57
State 3 - Recorded on 03-Mar-2010
Column1 Column2
Data1 0.58
User notices that state3 is not what he intended to be in, decides to revert back to state2.
One approach that I can think of, without modifying the entity is via "auditing" all the inserts/updates, as below, the rollback information captures the data just before the updates/modifications on the entity, so that it can be applied in an order when you need to revert.Please note that changing the entity's schema, is not an option.
Rollback - R1 recorded on 01-Mar-2010
Column1 Column2
Data1 0.56
Rollback - R2 Recorded on 02-Mar-2010
Column1 Column2
Data1 0.56
Rollback - R3 Recorded on 03-Mar-2010
Column1 Column2
Data1 0.57
So, to get to state2 , we would start with rollback information R1,apply R2 onto it.
Is there a better approach to achieve this ?
Thanks for your time.
© Stack Overflow or respective owner