Skip to content
Tom H Anderson edited this page May 31, 2016 · 2 revisions

zf-doctrine-audit may be applied to a pre-existing database. Also, once implemented, you may remove the audit log for archive and prime the audit record with the current database.

This is accomplished by creating an epoch. An epoch is an audit record for the database as it exists at a given point in time. An epoch should only happen when the audit database Revision, RevisionEntity, and RevisionEntityIdentifierValue data is empty.

Step a

If you are archiving an existing audit database you might set the auto increment values of the Revision, RevisionEntity, and RevisionEntityIdentifierValue tables in series with your last audit. This way you can continue to archive audit databases and have an on-going audit log so combining the audit archives is possible.

Step 1

Start with an audit database populated only with fixtures.

Step 2

Currently only MySQL is supported and your audit database and target database must be on the same MySQL instance. If your audit database is not on the same instance you may choose to host them together while the epoch is created.

Step 3

Run this command to create a set of stored procedures to audit the entire existing database

php index.php zf-doctrine-audit:epoch:import --mysql > epoch.sql

mysql -u root -p123 audit < epoch.sql
Clone this wiki locally