Log changes in a database (DBI)by citromatik (Curate)
|on May 03, 2011 at 10:45 UTC||Need Help??|
citromatik has asked for the
wisdom of the Perl Monks concerning the following question:
I am trying to figure out if this is possible, and if so, the best strategy to try to accomplish it
The scenario is as follows... I have a database controlled by an API and I have a complex system that runs pipelines (where a pipeline is a module defining how different scripts run in a given order, some in parallel, some sequentially, etc...) and these scripts writes in the database.
What I would like to do is to record (for example in a new table of the final database) all the changes in this database with information about the change itself, the component of the pipeline that made it (every script has an ID) and the time of the change.
The idea is to provide the system with "undo" operations or restore the DB to a given point in the pipeline.
Probably the best place to try to add this is at the API level. Everytime a change in the database is requested, try to grab the required information and update the "log" table. I don't know if mysql or the DBI module can be used to accomplish this at the DBI level.
Anyway... Any thoughts on this would be welcome
Thanks in advance,