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

+2
View File
@@ -54,6 +54,7 @@ pub mod reconcile;
pub mod schema;
pub mod search_dao;
pub mod user_ai_prefs_dao;
pub mod version_dao;
pub use calendar_dao::{CalendarEventDao, SqliteCalendarEventDao};
pub use daily_summary_dao::{DailySummaryDao, InsertDailySummary, SqliteDailySummaryDao};
@@ -71,6 +72,7 @@ pub use precomputed_reel_dao::{PrecomputedReelDao, SqlitePrecomputedReelDao};
pub use preview_dao::{PreviewDao, SqlitePreviewDao};
pub use search_dao::{SearchHistoryDao, SqliteSearchHistoryDao};
pub use user_ai_prefs_dao::{SqliteUserAiPrefsDao, UserAiPrefsDao};
pub use version_dao::{SqliteVersionDao, VersionDao};
pub trait UserDao {
fn create_user(&mut self, user: &str, password: &str) -> Option<User>;
+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,
File diff suppressed because it is too large. Load diff