šŸ”„ Roster Sync Admin

Copy rosters from offseasonRosters to rosters/{seasonId} collection

šŸ“‹ Source Data

Source: offseasonRosters/current.teams
Target: rosters/{seasonId}/{teamName}
This tool copies the current offseason rosters to the new centralized rosters collection organized by season.

šŸ”‘ Backfill Auth IDs

What this does: Scans rosters/{seasonId}-{teamName} docs for players missing an authId, queries /users by linkedPlayer name, and writes the UID back into the roster entry.

Use when: A player signed up after rosters were synced and their auth account isn't reflected in the roster doc.

🔧 Fix Roster Player IDs

What this does: Scans all roster docs for the selected season and detects players where the id field contains an Auth UID instead of a legacy snake_case ID (e.g. ralph_pombo). For each bad entry it looks up mergedFromProfile on the user doc to recover the correct legacy ID, then writes it back — moving the UID to authId.

Use when: Players were added via Auth UID rather than their legacy player ID, causing mismatches with batting orders and stats lookups.

📟 Sync Jersey Numbers from User Profiles

What this does: Scans roster docs for the selected season and looks up each player's number field from their user profile doc. For players with an authId it fetches directly by UID; for legacy-only players it queries by mergedFromProfile. Shows a preview of all changes before writing.

Use when: Players have updated their jersey number in their profile and you want those numbers reflected in the roster doc (used by game tracker, roster management, etc.)

🔍 Scan for Legacy ID Mismatches

What this does: Scans roster docs for the selected season and compares each player's id field against their mergedFromProfile on their user doc (looked up via authId). Flags players where the two don't match — for example justin_r_hannon vs justin_hannon. These mismatches cause stats lookups to silently fail.

Use when: A player's stats aren't loading in submit-stats or the game tracker despite being on the roster.