Prostore::Steps::Planner
Operation → ordered Step list (ADR-0009 invariant 1).
Most operations map 1:1 to atomic steps. AddField is the exception:
when the field is non-nullable AND has a backfill: distinct from the
column-level default:, it decomposes into:
AddColumnNullable + Backfill(SqlExpr | CrystalLambda) + ApplyNotNull
The ordering reflects ADR-0009 invariant 3: the backfill loop's WHERE col IS NULL predicate requires the column to exist as nullable first; ApplyNotNull only tightens after the backfill has populated every row.
The single-step AddColumn path stays for:
- Nullable fields (no backfill needed; existing rows keep NULL).
- Non-null fields whose
default: SQL.expr(...)doubles as the existing-row populator (SQLite ADD COLUMN ... NOT NULL DEFAULT applies the default to existing rows in one statement).