fix canonical_id reset: stop wiping enrichment data on re-sync

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-03 14:09:32 +01:00
parent 2d50198782
commit ff98d7e64f
2 changed files with 3 additions and 3 deletions

View File

@@ -123,14 +123,14 @@ export function useSaveConfig() {
export function useSaveGamesBySource() { export function useSaveGamesBySource() {
return useCallback( return useCallback(
async (source: string, games: Omit<Game, "rating" | "game_state" | "is_favorite">[]) => { async (_source: string, games: Omit<Game, "rating" | "game_state" | "is_favorite">[]) => {
const db = await getDb() const db = await getDb()
for (const game of games) { for (const game of games) {
await db.query( await db.query(
`INSERT INTO games (id, title, source, source_id, platform, last_played, playtime_hours, url, canonical_id, updated_at) `INSERT INTO games (id, title, source, source_id, platform, last_played, playtime_hours, url, canonical_id, updated_at)
VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, NOW()) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, NOW())
ON CONFLICT (id) DO UPDATE SET ON CONFLICT (id) DO UPDATE SET
title = $2, last_played = $6, playtime_hours = $7, url = $8, canonical_id = $9, updated_at = NOW()`, title = $2, last_played = $6, playtime_hours = $7, url = $8, updated_at = NOW()`,
[ [
game.id, game.id,
game.title, game.title,

View File

@@ -131,7 +131,7 @@ async function saveGamesBySource(
`INSERT INTO games (id, title, source, source_id, platform, last_played, playtime_hours, url, canonical_id, updated_at) `INSERT INTO games (id, title, source, source_id, platform, last_played, playtime_hours, url, canonical_id, updated_at)
VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, NOW()) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, NOW())
ON CONFLICT (id) DO UPDATE SET ON CONFLICT (id) DO UPDATE SET
title = $2, last_played = $6, playtime_hours = $7, url = $8, canonical_id = $9, updated_at = NOW()`, title = $2, last_played = $6, playtime_hours = $7, url = $8, updated_at = NOW()`,
[ [
game.id, game.id,
game.title, game.title,