Your Parents Holidayed in Yugoslavia

Your Parents Holidayed in Yugoslavia

Your parents flew to Split for their summer holiday. They went to Yugoslavia. Yugoslavia doesn't exist any more, so why does your flight tracker insist they went to Croatia?

That's the question that made me realise my nice, simple CRUD database had quietly stopped being simple. Airlines merge and rebrand. Airports get renamed, and sometimes change country. Borders move. A row that just says "Croatia" rewrites my parents' holiday every time the world does.

This is the story of how a hobby flight logger outgrew its schema, and what event sourcing actually looks like once you build it instead of reading blog posts about it. No Kafka, no swarm of microservices: just Symfony, Doctrine, Messenger and a few hundred lines of PHP. We'll go through the parts that matter (append-only events, projections, and the temporal queries that let me ask "what country was this on the day of the flight?") using real, messy aviation data.

And if your parents holidayed in Yugoslavia too, you're in the right room.

Marek Matulka

November 26, 2026

Annual Pro sale · Save $30

Have presentations of your own?

Share with private links, password protection, and more control over your work.

Transcript

54 slides
  1. Europe, 2010 Your holiday with your parents, to celebrate their

    30th anniversary… A flight from Warsaw, Poland to Split, Yugo… Croatia.
  2. Living data Airlines • • • adopt new branding merge

    with another, or split cease or restart operations Airports • • • • adopt new name adopt new designators move countries open or close Countries • • • • • • dissolve gain independence join or leave United Nations adopt new name adopt new flag get occupied or annexed 7/54
  3. How it started – the naïve approach flight_segments --------------id flight_date

    flight_number airline_id departure_airport_id arrival_airport_id airlines -------id name logo icao iata country airports -------id name icao iata country 9/54
  4. Users: We want to see all the countries we've visited

    Changes in the early 1990s: • • • • Czechoslovakia – split into Czechia and Slovakia Estonia, Latvia, Lithuania – restored independence Soviet Union – split into Armenia, Azerbaijan, Belarus, Georgia, Ukraine, … East Germany and West Berlin – merged with Germany Recent new countries: • • • • Timor-Leste (2002) – restored independence from Indonesia Kosovo (2008) – split from Serbia Aruba, Curaçao, Sint Maarten, Caribbean Netherlands (Bonaire, Saba, Sint Eustatius) (2010) – dissolution of Netherlands Antilles South Sudan (2011) – split from Sudan 10/54
  5. Borders change, but also… Airlines… • USAir rebranded as US

    Airways ◦ • kept United as a name adopted Continental's branding merged with a number of airlines, to stay afloat… British Airways absorbed bmi ◦ • adopted new name, branding, designators… • Alitalia went bust a number of times ◦ • • United merged with Continental ◦ ◦ • Airports… bmi ceased to exist rocky history of FlyBe ◦ ◦ ceased and restarted operations resurrected as a new airline • • DOH designator was used by Doha International (OTBD) till 2014, then Hamad International (OTHH) HKG and VHHH designators moved with the airport, when Hong Kong's iconic Kai Tak airport closed Johannesburg airport (JNB) changed its ICAO designator in 2013 Las Vegas Airport (LAS) was McCarran International from 1948 until 2021, when it became Harry Reid International 11/54
  6. The problem – current state vs historical truth flight_segments --------------id

    flight_date flight_number airline_id departure_airport_id arrival_airport_id airlines -------id version_id name logo icao iata country_id airports -------id version_id name icao iata country_id countries --------id version_id code name 12/54
  7. The problem – current state vs historical truth Every query

    became: • which version was active on this date? – required a correlated subquery on every join • every time I wrote a new query I had to decide: do I join on id or version_id? The answer wasn't always obvious, and getting it wrong meant silently incorrect data • all joins add performance penalty 13/54
  8. Don't update, append events Events represent the source of truth,

    paired with effective date — what has happened, and when. 15/54
  9. Don't update, append events Each event is paired with a

    command — a command asks for a change; an event records it. 16/54
  10. We learn about facts in any order… Sorted by when

    it happened, not when we learned it. Row 3 was recorded before row 2. Row 4, a week before both. 26/54
  11. You don't need to get it right first time, because

    the facts are preserved regardless.
  12. Only events change the state Recording an event applies it.

    Replaying applies the same events again. 30/54
  13. Real history makes the best test data Replay the events,

    expect the view. Each case is a real country's history. 41/54
  14. Migration strategy • Built alongside legacy ORM tables ◦ •

    Verification ◦ • Migration command ORM table to events Command checked records matched legacy ORM table vs projections Repository swap ◦ Replaced ORM repositories with projection repositories 43/54
  15. What we event-sourced (and what we didn't) Event-sourced Kept CRUD

    Aircraft Type • Airline • Airport ◦ they don't change • Country ◦ there might be multiple variants • Alliance • • Why? Flight Segment ◦ a flight segment is an event itself ◦ user may add missing details to it (e.g. aircraft tail number), but flight segment • Change over time • Historical accuracy does not change over time • Traveller ◦ little benefit, audit log is simpler 44/54
  16. Effective date vs. event timestamp Effective date – when the

    fact actually happened in the real world. 1991-06-25, when Croatia declared independence Event timestamp – when you recorded the fact in the system. Today, when you imported the data. 45/54
  17. Projections are disposable Events are the source of the truth

    Clean separation between business logic (changes to models), and presentation – achieving Command Query Responsibility Segregation (CQRS). 46/54
  18. The cost Pros Cons • historical accuracy • slower writes

    • fast data reads (flat DB table) • projection rebuild takes time • stats can be calculated in memory • more moving parts (code) 47/54
  19. When it earns its complexity Your checklist: ❏ do you

    have temporal queries? ❏ audit requirements? ❏ data that changes meaning retroactively? 48/54
  20. Symfony ecosystem Patchlevel Event Sourcing ✅ probably the best choice

    to start with • Website: patchlevel.dev • Docs: patchlevel.github.io/event-sourcing-docs • github.com/patchlevel/event-sourcing-bundle Ecotone Framework • Website: ecotone.tech • github.com/ecotoneframework/ecotone-dev EventSauce (framework-agnostic) • Website: eventsauce.io DIY (what My Flight Path does) • DBAL append-only event tables • a bit of code 50/54
  21. Where to start ❏ pick one aggregate that has a

    temporal problem ❏ don't rewrite everything at once ❏ build it alongside existing CRUD data and verify ❏ compare CRUD vs projection ❏ you won't get it right first time round, but rebuilding projections is trivial, fixing CRUD data isn't 51/54
  22. Summary Three takeaways: • Append, don't update • Only events

    change the state • Historical truth is a first-class concern 52/54

More Decks by Marek Matulka

Other Decks in Programming