When migrating from a legacy system to an event-sourced component, a common challenge is that the old system stores state but no history. Two typical approaches — keeping the legacy database as read-only or forcing legacy data into new domain events — both have significant downsides. The proposed solution introduces 'Migration Events': domain events in the new component that explicitly use the Ubiquitous Language of the old system (e.g., LegacyCustomerWasImported), making the migration transparent rather than hidden. The legacy system is treated as its own Bounded Context using DDD principles. Even after the legacy component is deleted, its Bounded Context persists as a 'Ghost Context' — a legacy Bounded Context with no implementation but with traces in other Bounded Contexts. This approach embraces the complexity of migration rather than hiding it, resulting in a more honest and understandable system.

4m read timeFrom verraes.net
Post cover image
Table of contents
ProblemCommon approachesMigration EventsGhost Context