fix: remove reversed-pair exemption from knockout stale cleanup
The NOT clause was protecting both (team1,team2,date) and (team2,team1,date) from deletion, preventing the stale cleanup from removing reversed-order duplicates — e.g. both "France vs Spain" and "Spain vs France" stored for the same SF slot. Only the exact pairing being upserted needs protection; reversed entries with the same date are duplicates and should be deleted. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
+2
-8
@@ -52,10 +52,7 @@ async function run() {
|
||||
AND is_quali_playoff = ${isQuali}
|
||||
AND score_ft_home IS NULL
|
||||
AND (team1_id = ${team1Id} OR team2_id = ${team1Id} OR team1_id = ${team2Id} OR team2_id = ${team2Id})
|
||||
AND NOT (
|
||||
(team1_id = ${team1Id} AND team2_id = ${team2Id} AND date IS NOT DISTINCT FROM ${dateStr})
|
||||
OR (team1_id = ${team2Id} AND team2_id = ${team1Id} AND date IS NOT DISTINCT FROM ${dateStr})
|
||||
)
|
||||
AND NOT (team1_id = ${team1Id} AND team2_id = ${team2Id} AND date IS NOT DISTINCT FROM ${dateStr})
|
||||
)
|
||||
`)
|
||||
await db.execute(sql`
|
||||
@@ -66,10 +63,7 @@ async function run() {
|
||||
AND is_quali_playoff = ${isQuali}
|
||||
AND score_ft_home IS NULL
|
||||
AND (team1_id = ${team1Id} OR team2_id = ${team1Id} OR team1_id = ${team2Id} OR team2_id = ${team2Id})
|
||||
AND NOT (
|
||||
(team1_id = ${team1Id} AND team2_id = ${team2Id} AND date IS NOT DISTINCT FROM ${dateStr})
|
||||
OR (team1_id = ${team2Id} AND team2_id = ${team1Id} AND date IS NOT DISTINCT FROM ${dateStr})
|
||||
)
|
||||
AND NOT (team1_id = ${team1Id} AND team2_id = ${team2Id} AND date IS NOT DISTINCT FROM ${dateStr})
|
||||
`)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user