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:
CameronandClaude Opus 4.7 authored and cameron committed 2026-04-21 01:55:07 +00:00
1 parent 2f4edba08c
commit ffcddbb843
17 files changed
+750 -108

No files matched your search

+3
View File
@@ -94,6 +94,7 @@ fn main() -> anyhow::Result<()> {
Ok(exif_data) => {
let timestamp = Utc::now().timestamp();
let insert_exif = InsertImageExif {
library_id: image_api::libraries::PRIMARY_LIBRARY_ID,
file_path: relative_path.clone(),
camera_make: exif_data.camera_make,
camera_model: exif_data.camera_model,
@@ -114,6 +115,8 @@ fn main() -> anyhow::Result<()> {
.map(|e| e.created_time)
.unwrap_or(timestamp),
last_modified: timestamp,
content_hash: None,
size_bytes: None,
};
// Store or update in database