These are chat archives for RBMHTechnology/eventuate

Jun 2017
Mardo Del Cid
Jun 27 2017 01:45

Hi Everyone!
I’m kinda new to event sourcing, and I was wondering how to solve the following scenario: Let’s say you have an event case class UserAdded(user: User), and User is case class User(username:String, birthday: Date).

Your app has been running for a while and now the customer wants to collect the Users’ phone number. So now we would change User to case class User(username:String, birthday: Date, phoneNumber: String).

When the events are replayed, it will throw an error because past events didn’t have a phoneNumber. How do you usually workaround this issue in a event-sourced application?

Any input is much appreciated!

Volker Stampa
Jun 27 2017 05:23
Hi @mardo, there is actually not much difference to a traditional application. As you typically do not have the phone numbers for all of your existing users, you must make it optional. Regarding event migration in general you may also want to have a look at #224 (even if this focuses on event migration for a distributed application, the section on Examples for schema evolution could be of interest). The DDD/CQRS/Event Sourcing List is certainly also a great source of inspiration.
Mardo Del Cid
Jun 27 2017 05:26
Oh Nice!
Thanks @volkerstampa, I think that’s what I was looking for