Back-fill events?

What is recommended approach when business rules change and now there is an additional event, when old event is now split into 2 events? We need to rebuild read-model, but i don’t want to put any custom logic in event handlers to account for this change. I was thinking that I could back fill ES with this new event, copy old events into new stream and add this additional event. I am finding little documentation or examples on how to do that. I found in one thread that apparently there is “copyTo” function as well, in addition to “emit” and “linkTo”. I need some guidance on how to proceed in this situation.

Any help would be appreciated.

I cover this type of change here https://leanpub.com/esversioning

So normally you would was to do this as a transform. Read stream/all events -> write stream events to a new stream/store. There are some other ways of doing it but they often are read->transform in memory which can have dependencies over time.

The main one being you must support that pipeline code forever and it can get “interesting” if you have say three things reading the same log and transforming in three different ways.

Hi Greg,
thanks for replying. I have one more question, is technique you describe here https://leanpub.com/esversioning/read#leanpub-auto-simple-copy-replace, something that can be done using ES projections, or am I better off writing custom code in C#?

I would normally do it outside but it could feasibly be done. To be honest I rarely would recommend copy/replace in general. I would generally focus on either:

no changes only app released

any changes new eventstore->copy/transform whole eventstore

The reason for this is those two processes cover every change. When thinking stream level stuff I have to think about every change. Then I would focus on getting changes into groups where has changes is the grouping.

no changes -> release any time!

has changes -> release on the weekly

Does that make sense?

If I understand it correctly, basically write a transformation outside of ES, read all events, run needed transformation and write into new ES. Now I am concerned about transition from old to new ES, as we cannot stop and transition must be seamless.