Search code examples
javers

Ability to purge old data


Is it possible to purge historical data in Javers?

Let's say I had no interest in keeping any audit data which is older than one year (month, etc.).

I could not find any similar API in Javers but is there at least a theoretical possibility of manually removing old records from SQL store or Mongo DB? Would Javers API continue to work in a predictable manner?


Solution

  • There is no such feature in JaVers, but you can purge data using a db script. I didn't tested it but I think that nothing bad will happen. Commits should be deleted in chronological order. In SQL repository, commits are persisted in three tables, so:

    delete from jv_commit_property where commit_fk < x;
    delete from jv_snapshot where commit_fk < x;
    delete from jv_commit where commit_pk < x;