image_exif: add date_taken_source column

New nullable TEXT column tracks which step of the canonical-date
waterfall (kamadak-exif → exiftool → filename → fs_time) populated
`date_taken`. Lets a later per-tick drain re-resolve weak sources
(`fs_time`) once stronger ones become available, and gives the UI/debug
surface a way to answer "why does this photo show up under this date?".

Adds the column at all `InsertImageExif` construction sites with `None`
placeholders (the resolver wiring lands in a follow-up commit), and
extends the `update_exif` SET tuple so the column survives the GPS-write
re-read path. Partial index `idx_image_exif_date_backfill` is created
for the upcoming drain query.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Cameron Cordes
2026-05-06 15:57:49 -04:00
parent 5de9a322ac
commit 84326501a9
7 changed files with 45 additions and 0 deletions

View File

@@ -537,6 +537,8 @@ async fn set_image_gps(
// with a usable signal; failure just leaves prior values in place.
phash_64: perceptual_hash::compute(&full_path).map(|h| h.phash_64),
dhash_64: perceptual_hash::compute(&full_path).map(|h| h.dhash_64),
// Replaced in a follow-up commit with the canonical-date resolver's output.
date_taken_source: None,
};
let updated = {
@@ -772,6 +774,8 @@ async fn upload_image(
size_bytes,
phash_64: perceptual.map(|h| h.phash_64),
dhash_64: perceptual.map(|h| h.dhash_64),
// Replaced in a follow-up commit with the canonical-date resolver's output.
date_taken_source: None,
};
if let Ok(mut dao) = exif_dao.lock() {
@@ -2410,6 +2414,8 @@ fn process_new_files(
size_bytes,
phash_64: perceptual.map(|h| h.phash_64),
dhash_64: perceptual.map(|h| h.dhash_64),
// Replaced in a follow-up commit with the canonical-date resolver's output.
date_taken_source: None,
};
let mut dao = exif_dao.lock().expect("Unable to lock ExifDao");