Dividend Backfill

Repairs dividends.meeting_id, race_id, country_id and racecard_race_id, sourced from tbldividends.MeetingID / RaceID / CountryID / PreRaceID. A dividend inserted before its meeting or race had been migrated is left with a NULL meeting and a race of 0, even though config_id_mappings now holds the correct mapping. For every already-migrated dividend in range this re-reads the current source ids, translates them through the current meeting/race mappings, and corrects whichever column disagrees.

tbldividends has no date, so the range is set by meeting: the run finds the earliest meeting dated 2026-08-01 and checks every dividend whose source MeetingID is at or after it, through to the newest. A parent that hasn't been migrated yet is left alone (and counted), never auto-copied; a dividend that hasn't been migrated at all is left to Auto Sync. A value that is any valid mapping for its parent is treated as correct.

  • Dividend → Meeting FK MeetingID → dividends.meeting_id
  • Dividend → Race FK RaceID → dividends.race_id
  • Dividend → Country FK CountryID → dividends.country_id
  • Dividend → Racecard Race FK PreRaceID → dividends.racecard_race_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.

1440 = daily · 10080 = weekly