brackt/scripts/backfill
Chris Parsons f3937d0d84
feat: auto-provision canonical tournaments and participants on create
Creating new qualifying scoring_events or season_participants now
auto-upserts the matching canonical rows. Needed so the check constraint
doesn't reject qualifying events, and so new season participants
flow through syncTournamentResults.

- Extract tournament identity shared between backfill and event-creation
  into app/lib/tournament-identity.ts; scripts/backfill re-exports it.
- createScoringEvent + bulkCreateScoringEvents now accept tournamentId.
- Event creation routes auto-compute (name, year) and upsert tournament.
- createParticipant + createManyParticipants auto-link to canonical
  participants by (sportId, name).

Phase 3 Task 7 of canonical tournament layer migration.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-01 22:32:16 +00:00
..
__tests__ scripts: add extractTournamentIdentity helper for backfill 2026-05-01 20:47:23 +00:00
match-tournament.ts feat: auto-provision canonical tournaments and participants on create 2026-05-01 22:32:16 +00:00