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:
@@ -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,
|
||||||
|
|||||||
@@ -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,
|
||||||
|
|||||||
Reference in New Issue
Block a user