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:
+6
-1
@@ -166,9 +166,14 @@ async function run() {
|
|||||||
CREATE UNIQUE INDEX IF NOT EXISTS squads_unique ON squads (tournament_year, team_id, shirt_number);
|
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>()
|
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)!
|
if (teamCache.has(name)) return teamCache.get(name)!
|
||||||
const iso2 = extra?.iso2 ?? getIso(name)
|
const iso2 = extra?.iso2 ?? getIso(name)
|
||||||
const [row] = await db.execute(sql`
|
const [row] = await db.execute(sql`
|
||||||
|
|||||||
Reference in New Issue
Block a user