You might prefer the OO, UML, etc. forum down the page for questions like this. We love this kinda stuff down there.
Memento can be used for undo by storing all state or the state that changes on every change. To undo you simply restore the most recent saved state.
Command can be used to undo by storing compensating commands. To undo you execute the most recent command. So if the change was to insert a new row in the database the undo might be a matching delete command.
I've seen these used in transaction rollback. If you update a database and a flat file in a transaction, you probably have to write your own rollback for the flat file.
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi