Trial Run Backfill
Repairs trial_run.course_id, trial_run.runner_id,
trial_run.jockey_id and trial_run.trainer_id, sourced from
tblbarriertrials.BCourseID / BHorseID / BJockeyID /
BTrainerID. Barrier Trials resolves these once at insert time and never
revisits an already-migrated row, so a value that was wrong at insert (pointing at a
different, unrelated source entity's destination row, a 0/default, or a sibling/self
fallback) otherwise stays wrong even though config_id_mappings holds the
correct mapping. For every already-migrated trial_run row this re-reads the
current source ids, translates them through the current
config_id_mappings, and corrects whichever column(s) disagree.
jockey_id/trainer_id are discipline-aware (resolved via
the trial's BDiscipline). course_id/runner_id
accept any of a source id's mapped destinations (duplicate parents are not errors). A
parent that was never migrated is left alone, never auto-copied. By default only trials
dated on or after 2026-08-01 are touched (untick the box below for a full run).
- Trial Run → Course FK BCourseID → trial_run.course_id
- Trial Run → Runner FK BHorseID → trial_run.runner_id
- Trial Run → Jockey FK discipline-aware BJockeyID → trial_run.jockey_id
- Trial Run → Trainer FK discipline-aware BTrainerID → trial_run.trainer_id
Preview runs the exact same reads and resolves the exact same expected values, but skips the actual write — no column 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.