.netnhibernatenhibernate-envers

nhibernate envers: auditing an entity already in production


We have an application that is already in production and it is using Envers to do auditing.

Now we are going to release an update in which we audit a new kind of entity. However this entity already exists in the production environment, only it was not audited so far.

We have tried in a test environment containing existings records, and it crashes upon saving because Envers cannot find a previous revision for the entity being saved.

What is the approach to takle this issue ?

It would be great for instance if one could specify the date from which an entity should be audited.


Solution

  • You have to, manually, write a script for this. Shouldn't be that hard, just create a single row in your revision table and write "insert audit records" for this revision for all your audited entities.