fix: normalize West Germany → Germany in sync script and repair existing data

openfootball uses 'West Germany' for 1954–1990 era matches. All DB references
(matches, goals, group_standings, squads) have been merged into the Germany
team on both local and VPS. TEAM_ALIASES map prevents re-creation on re-sync.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-06-14 17:12:06 +02:00
parent 48f7e71a8e
commit 42019e5035
+6 -1
View File
@@ -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<string, string> = {
'West Germany': 'Germany',
}
const teamCache = new Map<string, number>()
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`