diff --git a/scripts/sync.ts b/scripts/sync.ts index cbaeb19..3c35674 100644 --- a/scripts/sync.ts +++ b/scripts/sync.ts @@ -166,9 +166,14 @@ async function run() { CREATE UNIQUE INDEX IF NOT EXISTS squads_unique ON squads (tournament_year, team_id, shirt_number); `) + const TEAM_ALIASES: Record = { + 'West Germany': 'Germany', + } + const teamCache = new Map() - async function upsertTeam(name: string, extra?: { iso2?: string; fifaCode?: string; continent?: string; confederation?: string }) { + async function upsertTeam(rawName: string, extra?: { iso2?: string; fifaCode?: string; continent?: string; confederation?: string }) { + const name = TEAM_ALIASES[rawName] ?? rawName if (teamCache.has(name)) return teamCache.get(name)! const iso2 = extra?.iso2 ?? getIso(name) const [row] = await db.execute(sql`