feat(versions): schema and VersionDao for hash-keyed photo versions

photo_versions links a version's content_hash to its primary original's;
photo_version_references keeps provenance-only reference photos;
photo_version_display holds the global display choice. VersionDao covers
linking (chains flatten to the root), the display choice, per-original
summaries for /photos, the hidden-row set for non-SQL listings, and the
copy of the original's date/GPS/camera onto version rows. Also the SQL
predicate listings use to hide a version while its original is reachable.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Cameron CordesandClaude Opus 5.5 committed 2026-10-30 11:16:32 -04:00
1 parent e7aaa961ad
commit 044240037a
5 files changed
+1155

No files matched your search

+30
View File
@@ -345,6 +345,33 @@ diesel::table! {
}
}
diesel::table! {
photo_version_display (original_hash) {
original_hash -> Text,
display_hash -> Text,
decided_at -> BigInt,
}
}
diesel::table! {
photo_version_references (version_hash, reference_hash) {
version_hash -> Text,
reference_hash -> Text,
}
}
diesel::table! {
photo_versions (version_hash) {
version_hash -> Text,
original_hash -> Text,
kind -> Text,
source -> Text,
created_at -> BigInt,
library_id -> Integer,
rel_path -> Text,
}
}
diesel::table! {
precomputed_reels (id) {
id -> Integer,
@@ -392,6 +419,9 @@ diesel::allow_tables_to_appear_in_same_query!(
personas,
persons,
photo_insights,
photo_version_display,
photo_version_references,
photo_versions,
precomputed_reels,
search_history,
tagged_photo,