Race Meeting Backfill

Repairs the FK columns on race: rmeeting_id (→ meeting, from tblraces.RMeetingID), course_id, country_id and feature_race_id. This value can end up wrong in three distinct ways: never resolved at migration time (the raw, untranslated source id was left in place), resolved to a same-day sibling meeting because the true parent meeting hadn't been auto-copied yet at that moment, or correct at migration time but the source later reassigned the race to a different meeting with nothing re-syncing it. A single rule fixes all three: for every already-migrated race row, this re-reads its current source RMeetingID, translates it through the current config_id_mappings, and corrects the column if it disagrees.

Only already-resolvable rows are touched — a race whose meeting genuinely hasn't migrated yet is left alone and counted as skipped, never auto-copied. This is a targeted, single-column pass, unrelated to and safe alongside Auto Sync and other backfills: it only ever reads/updates race rows that already have a durable config_id_mappings entry, which Auto Sync never touches mid-insert.

  • Race → Meeting FK tblraces.RMeetingID → race.rmeeting_id
  • Race → Course FK tblraces.RCourseID → race.course_id
  • Race → Country FK tblraces.RCountryID → race.country_id
  • Race → Feature Race FK tblraces.RFeatureCode → race.feature_race_id

Preview runs the exact same reads and resolves the exact same expected values, but skips the actual write — no race FK 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.

1440 = daily · 10080 = weekly