mindas
mindas

Reputation: 26713

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?

Upvotes: 2

Views: 1070

Answers (2)

Andi
Andi

Reputation: 700

I figured out that for MongoDB you can delete the documents in the jv_snapshots collection, but then you have to make sure that for each globalId_key, the lowest version number is of type INITIAL. Otherwise javers will fail with an exception when trying to read the snapshots for this golbalId_key.

enter image description here

Upvotes: 1

Bartek Walacik
Bartek Walacik

Reputation: 3496

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;

Upvotes: 3

Related Questions