Rolling back file moves, folder deletes and mysql queries

Posted by Workoholic on Stack Overflow See other posts from Stack Overflow or by Workoholic
Published on 2010-04-29T19:07:34Z Indexed on 2010/04/29 19:37 UTC
Read the original article Hit count: 271

Filed under:
|
|

This has been bugging me all day and there is no end in sight. When the user of my php application adds a new update and something goes wrong, I need to be able to undo a complex batch of mixed commands. They can be mysql update and insert queries, file deletes and folder renaming and creations.

I can track the status of all insert commands and undo them if an error is thrown. But how do I do this with the update statements? Is there a smart way (some design pattern?) to keep track of such changes both in the file structure and the database?

My database tables are MyISAM. It would be easy to just convert everything to InnoDB, so that I can use transactions. That way I would only have to deal with the file and folder operations. Unfortunately, I cannot assume that all clients have InnoDB support. It would also require me to convert many tables in my database to InnoDB, which I am hesitant to do.

© Stack Overflow or respective owner

Related posts about php

Related posts about rollback