Today we already have a delete_stream option which allows us to remove and rebuild streams. This is pretty good, however if we are looking into rebuilding a stream where only a small part of the events should be removed then removing and rebuilding a stream is a big ask.
If I have a stream where a few events were wrongly assigned to, it would be ideal to be able to remove these easily. eg: unlink_from_stream("THING$123", ["a5ad1617-b3bb-42cb-b85f-d7aa71f26bd0"]).
I understand that there are some issues here:
What if there is position value? -> We could error when we try to delete an event from a stream that has a specific position. Possibly we can make a unsafe_unlink_from_stream("THING$123", ["a5ad1617-b3bb-42cb-b85f-d7aa71f26bd0"]) so also events with position can be deleted.
As developers we can already do this, by directly modifying the storage layer DELETE FROM event_store_events_in_streams WHERE event_id in ('a5ad1617-b3bb-42cb-b85f-d7aa71f26bd0') AND stream = 'THING$123' AND position IS NULL does the same thing.
But I believe that having it in the lib would be useful.
Today we already have a
delete_streamoption which allows us to remove and rebuild streams. This is pretty good, however if we are looking into rebuilding a stream where only a small part of the events should be removed then removing and rebuilding a stream is a big ask.If I have a stream where a few events were wrongly assigned to, it would be ideal to be able to remove these easily. eg:
unlink_from_stream("THING$123", ["a5ad1617-b3bb-42cb-b85f-d7aa71f26bd0"]).I understand that there are some issues here:
What if there is position value? -> We could error when we try to delete an event from a stream that has a specific position. Possibly we can make a
unsafe_unlink_from_stream("THING$123", ["a5ad1617-b3bb-42cb-b85f-d7aa71f26bd0"])so also events with position can be deleted.As developers we can already do this, by directly modifying the storage layer
DELETE FROM event_store_events_in_streams WHERE event_id in ('a5ad1617-b3bb-42cb-b85f-d7aa71f26bd0') AND stream = 'THING$123' AND position IS NULLdoes the same thing.But I believe that having it in the lib would be useful.