Search code examples
cqrsevent-sourcing

CQRS/ES AR deletion command


Let's say I've an event sourced blog engine application in which I can create, publish and un-publish posts... I'm now wondering how to implement the post deletion command. Should I create a post deletion event, store it in the event store, and then, listen to that event to remove the projection, or should I fully delete the post, including any related events from the event store? The problem with the second solution is that I wouldn't be able to rolling back the deletion and I'm pretty sure that removing events from the events store is a really bad practice with event sourced applications.

Thank you for your advise.


Solution

  • If you are in a domain where you are using event sourcing, presumably because there is business value in temporal queries, then you are probably going to want soft deletes, rather than actually destroying the history you have accumulated.

    See also: Don't Delete -- Just Don't.