A complement to DbMigrator: where the former changes the
schema, this framework migrates existing rows’ data shape under a
schema that’s already current.
Components mirror the schema framework:
RecordUpgrader interface — fills in new fields on an
existing row. Must be additive and idempotent.
RecordUpgraderRegistry — ordered list +
CURRENT_RECORD_VERSION.
RecordMigrator — runs after DbMigrator,
paginates over rows with record_version <
CURRENT_RECORD_VERSION, applies the next upgrader, bumps the row’s
version. Per-row failures are isolated and logged but never block
startup.
This is the framework you’d use to backfill, say, capture_mode
for old rows after a new column lands — not to migrate schema (use
DbMigrator for that).