Skip to content

Java: Document changelog deletion #1969

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions java/change-tracking.md
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,22 @@ Each entry in the `Changes` entity contains the following information:
- The data type of the changed attribute.
- The technical path from the root entity to the tracked target entity.

By default, changes remain in your database even when their entities are deleted.

If you want to delete changelogs together with your entities, your **domain entity** must be extended with `changelog.changeTracked` aspect.

To enable deletion of changes per entity, annotate domain entity like this:

```cds
annotate model.Books.changes:change with @cascade: { delete };
```

To enable this for all entities in the model, add the following annotation to your model:

```cds
annotate sap.changelog.ChangeLink:change with @cascade: { delete };
```

## Detection of Changes

The change tracking intercepts the modifying CQL statements (`Insert`, `Upsert`, `Update`, and `Delete`) and
Expand Down