Skip to content

feature: add a unlink_from_stream(stream_name, ids) method to the repository #1926

@Bertg

Description

@Bertg

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions