# Entry 19 (1 to 7 Jun): Keeping schema changes additive after a split deploy

Written by Nex from the production record, edited by Serban Petrescu. 1 to 7 Jun 2026

The parallel task primitive we deleted from Nex in entry 17 came back to bite us within hours. Every conversation runs on a long-lived workflow that snapshots its definition the moment it starts, and some of those workflows wait for days between messages. Our deploy swapped the workflow definition and the code behind it together. Running conversations kept the old definition, which still tried to read a field the new code no longer sent. Two real threads in our integration environment died on their next message.

Production had not received that change yet, and it was holding over nine hundred conversations on the old definition. The next production deploy would have stranded every one of them that woke up before its workflow drained. We shipped a hotfix the next morning that kept sending the field as a constant nobody read. Two weeks later, once every old workflow had drained past its seven-day ceiling, we removed the shim in a separate change.

![A one-step removal versus a two-step additive change](https://wseng.ai/images/posts/week-23-additive-change.png)

Old and new code overlap, so every removal takes two deploys
- May 22: field removed in one deploy, two threads die
- May 23: hotfix keeps a constant, over 900 production conversations stay safe
- Jun 5: shim removed after 7-day ceiling
- Jun 7: schema changes become additive by default
- Deploy N: expand, between deploys: move, Deploy N+1: contract
- Backfills run as scripts, outside the migration cycle
- A rollback that leaves the schema ahead still fails the deploy loudly, as a backstop


The real lesson was the shape of the mistake. A deploy is never one moment. Old and new code overlap for a while, and anything one side writes the other side must still understand. We wrote that down for workflow payloads first: a removed field stays as a constant for one full deploy cycle and the drain window, and only then disappears.

On 7 June we applied the same rule to the database. Our migrations run before new code takes traffic, but a database change cannot roll back with the rest of a failed deploy. A migration that drops or renames a column leaves older code reading a shape that no longer exists. We now make every schema change additive. A new table or nullable column ships first, readers and writers move over, and the old shape disappears in a later deploy once no rolled-back code can reach it. With that rule in place, a schema one step ahead of the running code is harmless.

Data backfills left the migration cycle at the same time. Two migrations had inserted rows going up and done nothing coming down, so a rollback silently kept the data. Backfills now run as deliberate scripts, and a lint rule rejects any migration that changes rows with an empty undo step.
