Stewards Backfill
Repairs stewards.stew_runner_id — the FK from stewards to
runner, sourced from tblstewards.StewHID. This value can
end up wrong in two distinct ways: never resolved at migration time (left NULL),
or correct at migration time but the source horse's mapping later moved on (a stale,
still-valid-looking runner id) with nothing re-syncing it. A single rule fixes both: for
every already-migrated stewards row, this re-reads its current source
StewHID, translates it through the current
config_id_mappings, and corrects stew_runner_id if it disagrees.
Only already-resolvable rows are touched — a stewards row whose horse genuinely hasn't
migrated yet is left alone and counted as skipped, never auto-copied. Unlike Race Meeting
Backfill, this feature has no date-floor/cutoff: although stewards does have
a real date column (stew_date), the confirmed drift for this table spans a
range a standard cutoff would silently miss part of, so every run is a full, unbounded
sweep. This is a targeted, single-column pass, unrelated to and safe alongside Auto Sync
and other backfills: it only ever reads/updates stewards rows that already have a durable
config_id_mappings entry, which Auto Sync never touches mid-insert.
- Stewards → Runner FK tblstewards.StewHID → stewards.stew_runner_id
Preview runs the exact same reads and resolves the exact same expected
values, but skips the actual write — no stew_runner_id is changed. Use it to
see what would change before committing to a real run.
Scheduled Backfill
Runs this same re-resolution pass automatically on a recurring interval instead of only ever running it by hand.