feat: multi-library foundation (schema + libraries module)

Adds a `libraries` registry table and threads library_id through
per-instance metadata tables (image_exif, photo_insights,
entity_photo_links, video_preview_clips). File-path columns renamed to
rel_path to make the relative-to-root semantics explicit. Adds
content_hash + size_bytes on image_exif to support future hash-keyed
thumbnail/HLS dedup. Tags and favorites stay library-agnostic so they
share across libraries by rel_path.

Behavior is unchanged: a single primary library (id=1) is seeded from
BASE_PATH on first boot; all handlers and DAOs route through it as a
transitional shim until the API gains a library query param.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Cameron
2026-04-17 15:28:30 -04:00
parent 8bc948b297
commit 00da97fe86
17 changed files with 750 additions and 108 deletions

View File

@@ -1212,6 +1212,7 @@ mod tests {
// Return a dummy ImageExif for tests
Ok(crate::database::models::ImageExif {
id: 1,
library_id: data.library_id,
file_path: data.file_path.to_string(),
camera_make: data.camera_make.map(|s| s.to_string()),
camera_model: data.camera_model.map(|s| s.to_string()),
@@ -1229,6 +1230,8 @@ mod tests {
date_taken: data.date_taken,
created_time: data.created_time,
last_modified: data.last_modified,
content_hash: data.content_hash.clone(),
size_bytes: data.size_bytes,
})
}
@@ -1248,6 +1251,7 @@ mod tests {
// Return a dummy ImageExif for tests
Ok(crate::database::models::ImageExif {
id: 1,
library_id: data.library_id,
file_path: data.file_path.to_string(),
camera_make: data.camera_make.map(|s| s.to_string()),
camera_model: data.camera_model.map(|s| s.to_string()),
@@ -1265,6 +1269,8 @@ mod tests {
date_taken: data.date_taken,
created_time: data.created_time,
last_modified: data.last_modified,
content_hash: data.content_hash.clone(),
size_bytes: data.size_bytes,
})
}