Building Elsa 4 · Week 20: Migrating the Host You Actually Deploy

By Sipke Schoorstra · 2026-09-25

Building Elsa 4 · Week 20: Migrating the Host You Actually Deploy

The Elsa CLI discovers and runs EF Core migrations from the deployed host's packages, with explicit validation before production features activate.

September 18–24, 2026

Last week we switched the reference hosts to EF Core. This week we worked on something that matters once you deploy a host assembled from packages. The migrations you review and apply need to come from the same feature versions and provider assemblies that the host will use when it starts. EF host switch, ADR 0076

One set of compiled migrations

In the repo, a script can point dotnet ef at a design-time factory. A packaged Elsa.Foundation.Host can discover its features and their providers through Nuplane. The tool therefore launches a worker using the target host's build output and resolves migration tooling in that host's dependency set. That makes the packaged path and the in-process path produce the same migration artifact for the same inputs. CLI and worker

dotnet elsa persistence can list modules, plan and generate reviewable SQL where supported, and check generated scripts. apply and validate operate on the compiled migrations for the selected modules. An operator can pass the connection through an environment variable or stdin, keeping the connection string out of the process arguments. Plan and script commands, Apply and validation

We also changed when migration checks run. The Production reference configuration validates at startup, leaving schema changes to an explicit deployment step. Under that policy, enabling a feature with a pending migration is refused before the enabled feature set is saved. That second check matters when features can be turned on after the host has started. Production validation policy, Feature activation guard

Two places where the layout matters

EF's default schema setting affects the model. The migration SQL generator reads the schema from each migration operation. Elsa now passes the configured schema through to those operations, including nested ones, so a module can query and migrate the same tables using one set of compiled migrations. Schema-aware migration operations

We also divided the source trees into Essentials, Extensions, and Apps. The separation gave the engine and Studio clearer homes for the code needed by a base installation, optional capabilities, and runnable hosts. On the backend, the move followed a separate build gate for the core. Foundation layout, Studio layout

The ten required tooling slices landed and ADR 0076 was accepted. That gave us a way to answer whether one deployed host had the schema it needed. The next problem was coordinating what hosts could read and write when a fleet was halfway through an upgrade. Tooling closeout, Rolling schema design