mirror of
https://github.com/immich-app/immich
synced 2026-08-29 13:15:45 +00:00
`upsertExif` writes derived audio, video and keyframe metadata with an
`ON CONFLICT DO UPDATE`, but every column in those three update lists
assigns the stored row back to itself:
bitrate: ref('asset_audio.bitrate')
`SET bitrate = asset_audio.bitrate` is a self-assignment, so once a row
exists nothing can change it. Re-running metadata extraction re-reads the
file, builds a fresh snapshot, and then quietly discards it. The rest of the
file already uses `excluded` for this, as does `plugin.repository.ts`.
`asset_video.frameCount` had a second problem: it is supplied on insert but
was missing from the update list, so it would have stayed stale even after
the reference was corrected.
Extraction is meant to be repeatable. Probing improves between releases, a
file can be repaired or replaced, and a fix to how a stream is chosen is
worthless if it cannot reach the assets that were already imported. An
`upsert` that silently degrades to insert-only defeats all of that.
Metadata extraction is the only caller that passes these three objects, and
it passes a complete snapshot or nothing: each object is built from a single
probe behind a guard, and `upsertExif` skips the branch entirely when the
object is absent. So taking the incoming row cannot write partial values
over good ones. The other three callers pass `exif` only, and every other
reference to these tables is a read.
|
||
|---|---|---|
| .. | ||
| factories | ||
| fixtures | ||
| medium | ||
| repositories | ||
| mappers.ts | ||
| medium.factory.ts | ||
| small.factory.ts | ||
| utils.ts | ||
| vitest.config.medium.mjs | ||
| vitest.config.mjs | ||