Envers and batch loading scripts

188 Views Asked by At

I originally loaded some data through a liquibase script, and this has resulted in the envers audit table missing the insert records. So while I have update records, I do not have original insert records

I've written a data script to reinsert this data with the create records - but it is a fairly heavy weight script as you have to consider 4 scenarios -

  • Data with existing insert records - no migration
  • Data with update/delete records but no insert records - need insert records
  • Data with no audit entries - this is bulk upload without any subsequent changes
  • Reset Existing records

The scripts written, but is there an easier way to do this? Or did I just mess up not creating the initial insert records?

Im guessing you dont need the update/delete records - but I am using the audit table in a view

Thanks

1

There are 1 best solutions below

1
Roger On

Do you need to keep old update/delete audit records? If not - and it's ok to "start over" in auditing - you can simply remove all present audit history. Then "move" all present state to audit records as inserts pointing to revision 1 .