Files
ImageApi/src/database/schema.rs
T
Cameron Cordes d2263be6ac feat(dates): container video dates, filesystem branch, manual edit (#115)
The exiftool branch of the date waterfall now pulls raw strings with
group prefixes (one `exiftool -j -q -G1` subprocess per batch, no
`-d %s`) and classifies each candidate:

- zoned strings (own offset / Z) are true instants;
- naive strings from container groups (QuickTime/Track*/Apple) are
  UTC-rendered creation_time fields -> true instants (utc_direct).
  Running them through the camera wall-clock cascade was the
  "videos off by 4-5 hours" bug: it reinterpreted a UTC instant in
  the server zone;
- naive strings from photo-EXIF groups are camera wall clocks and run
  the offset cascade (OffsetTime* pairing + GPS evidence pulled in
  the same exiftool pass).

The legacy date_taken column stays byte-identical to the old
server-local interpretation (reproduced in Rust, DST-aware); the
new-contract date_utc / camera_offset_minutes / date_taken_tz_source
columns carry the true instant.

Manual date edit (POST /image/exif/date) reinterprets the
naive-as-UTC epoch the client sent as a wall clock in the user's
display zone (camera_tz::manual_date_resolution, tz_source =
'manual'), snapshots the pre-override new-contract triple next to the
existing legacy snapshot pair (3 new columns, migration
2026-09-25-000000), and revert restores both pairs.

ADR-0001 records the container-date finding; CLAUDE.md date-pipeline
section updated.
2026-09-25 15:26:26 -04:00

380 lines
9.8 KiB
Rust

// @generated automatically by Diesel CLI.
diesel::table! {
calendar_events (id) {
id -> Integer,
event_uid -> Nullable<Text>,
summary -> Text,
description -> Nullable<Text>,
location -> Nullable<Text>,
start_time -> BigInt,
end_time -> BigInt,
all_day -> Bool,
organizer -> Nullable<Text>,
attendees -> Nullable<Text>,
embedding -> Nullable<Binary>,
created_at -> BigInt,
source_file -> Nullable<Text>,
}
}
diesel::table! {
daily_conversation_summaries (id) {
id -> Integer,
date -> Text,
contact -> Text,
summary -> Text,
message_count -> Integer,
embedding -> Binary,
created_at -> BigInt,
model_version -> Text,
}
}
diesel::table! {
entities (id) {
id -> Integer,
name -> Text,
entity_type -> Text,
description -> Text,
embedding -> Nullable<Binary>,
confidence -> Float,
status -> Text,
created_at -> BigInt,
updated_at -> BigInt,
}
}
diesel::table! {
entity_facts (id) {
id -> Integer,
subject_entity_id -> Integer,
predicate -> Text,
object_entity_id -> Nullable<Integer>,
object_value -> Nullable<Text>,
source_photo -> Nullable<Text>,
source_insight_id -> Nullable<Integer>,
confidence -> Float,
status -> Text,
created_at -> BigInt,
persona_id -> Text,
user_id -> Integer,
valid_from -> Nullable<BigInt>,
valid_until -> Nullable<BigInt>,
superseded_by -> Nullable<Integer>,
created_by_model -> Nullable<Text>,
created_by_backend -> Nullable<Text>,
last_modified_by_model -> Nullable<Text>,
last_modified_by_backend -> Nullable<Text>,
last_modified_at -> Nullable<BigInt>,
}
}
diesel::table! {
entity_photo_links (id) {
id -> Integer,
entity_id -> Integer,
library_id -> Integer,
rel_path -> Text,
role -> Text,
}
}
diesel::table! {
face_detections (id) {
id -> Integer,
library_id -> Integer,
content_hash -> Text,
rel_path -> Text,
bbox_x -> Nullable<Float>,
bbox_y -> Nullable<Float>,
bbox_w -> Nullable<Float>,
bbox_h -> Nullable<Float>,
embedding -> Nullable<Binary>,
confidence -> Nullable<Float>,
source -> Text,
person_id -> Nullable<Integer>,
status -> Text,
model_version -> Text,
created_at -> BigInt,
}
}
diesel::table! {
favorites (id) {
id -> Integer,
userid -> Integer,
rel_path -> Text,
}
}
diesel::table! {
image_exif (id) {
id -> Integer,
library_id -> Integer,
rel_path -> Text,
camera_make -> Nullable<Text>,
camera_model -> Nullable<Text>,
lens_model -> Nullable<Text>,
width -> Nullable<Integer>,
height -> Nullable<Integer>,
orientation -> Nullable<Integer>,
gps_latitude -> Nullable<Float>,
gps_longitude -> Nullable<Float>,
gps_altitude -> Nullable<Float>,
focal_length -> Nullable<Float>,
aperture -> Nullable<Float>,
shutter_speed -> Nullable<Text>,
iso -> Nullable<Integer>,
date_taken -> Nullable<BigInt>,
created_time -> BigInt,
last_modified -> BigInt,
content_hash -> Nullable<Text>,
size_bytes -> Nullable<BigInt>,
phash_64 -> Nullable<BigInt>,
dhash_64 -> Nullable<BigInt>,
duplicate_of_hash -> Nullable<Text>,
duplicate_decided_at -> Nullable<BigInt>,
date_taken_source -> Nullable<Text>,
original_date_taken -> Nullable<BigInt>,
original_date_taken_source -> Nullable<Text>,
clip_embedding -> Nullable<Binary>,
clip_model_version -> Nullable<Text>,
date_utc -> Nullable<BigInt>,
camera_offset_minutes -> Nullable<Integer>,
date_taken_tz_source -> Nullable<Text>,
original_date_utc -> Nullable<BigInt>,
original_camera_offset_minutes -> Nullable<Integer>,
original_date_taken_tz_source -> Nullable<Text>,
}
}
diesel::table! {
libraries (id) {
id -> Integer,
name -> Text,
root_path -> Text,
created_at -> BigInt,
enabled -> Bool,
excluded_dirs -> Nullable<Text>,
}
}
diesel::table! {
location_history (id) {
id -> Integer,
timestamp -> BigInt,
latitude -> Float,
longitude -> Float,
accuracy -> Nullable<Integer>,
activity -> Nullable<Text>,
activity_confidence -> Nullable<Integer>,
place_name -> Nullable<Text>,
place_category -> Nullable<Text>,
embedding -> Nullable<Binary>,
created_at -> BigInt,
source_file -> Nullable<Text>,
}
}
diesel::table! {
persona_chat_conversations (conversation_id) {
conversation_id -> Text,
user_id -> Integer,
persona_id -> Text,
title -> Text,
messages_json -> Text,
turn_count -> Integer,
created_at -> BigInt,
updated_at -> BigInt,
}
}
diesel::table! {
personas (id) {
id -> Integer,
user_id -> Integer,
persona_id -> Text,
name -> Text,
system_prompt -> Text,
is_built_in -> Bool,
include_all_memories -> Bool,
created_at -> BigInt,
updated_at -> BigInt,
reviewed_only_facts -> Bool,
allow_agent_corrections -> Bool,
}
}
diesel::table! {
persons (id) {
id -> Integer,
name -> Text,
cover_face_id -> Nullable<Integer>,
entity_id -> Nullable<Integer>,
created_from_tag -> Bool,
notes -> Nullable<Text>,
created_at -> BigInt,
updated_at -> BigInt,
is_ignored -> Bool,
}
}
diesel::table! {
photo_insights (id) {
id -> Integer,
library_id -> Integer,
rel_path -> Text,
title -> Text,
summary -> Text,
generated_at -> BigInt,
model_version -> Text,
is_current -> Bool,
training_messages -> Nullable<Text>,
approved -> Nullable<Bool>,
backend -> Text,
fewshot_source_ids -> Nullable<Text>,
content_hash -> Nullable<Text>,
num_ctx -> Nullable<Integer>,
temperature -> Nullable<Float>,
top_p -> Nullable<Float>,
top_k -> Nullable<Integer>,
min_p -> Nullable<Float>,
system_prompt -> Nullable<Text>,
persona_id -> Nullable<Text>,
prompt_eval_count -> Nullable<Integer>,
eval_count -> Nullable<Integer>,
}
}
diesel::table! {
search_history (id) {
id -> Integer,
timestamp -> BigInt,
query -> Text,
search_engine -> Nullable<Text>,
embedding -> Binary,
created_at -> BigInt,
source_file -> Nullable<Text>,
}
}
diesel::table! {
tagged_photo (id) {
id -> Integer,
rel_path -> Text,
tag_id -> Integer,
created_time -> BigInt,
content_hash -> Nullable<Text>,
}
}
diesel::table! {
tags (id) {
id -> Integer,
name -> Text,
created_time -> BigInt,
}
}
diesel::table! {
users (id) {
id -> Integer,
username -> Text,
password -> Text,
}
}
diesel::table! {
user_ai_prefs (id) {
id -> Integer,
voice -> Nullable<Text>,
tz_offset_minutes -> Nullable<Integer>,
library -> Nullable<Text>,
updated_at -> BigInt,
display_tz -> Nullable<Text>,
}
}
diesel::table! {
video_preview_clips (id) {
id -> Integer,
library_id -> Integer,
rel_path -> Text,
status -> Text,
duration_seconds -> Nullable<Float>,
file_size_bytes -> Nullable<Integer>,
error_message -> Nullable<Text>,
created_at -> Text,
updated_at -> Text,
}
}
diesel::table! {
insight_generation_jobs (id) {
id -> Integer,
library_id -> Integer,
file_path -> Text,
generation_type -> Text,
status -> Text,
started_at -> BigInt,
completed_at -> Nullable<BigInt>,
result_insight_id -> Nullable<Integer>,
error_message -> Nullable<Text>,
}
}
diesel::table! {
precomputed_reels (id) {
id -> Integer,
span -> Text,
library_key -> Text,
cache_key -> Text,
output_path -> Text,
title -> Text,
media_count -> Integer,
render_version -> Integer,
tz_offset_minutes -> Integer,
voice -> Nullable<Text>,
generated_at -> BigInt,
}
}
diesel::joinable!(entity_facts -> photo_insights (source_insight_id));
diesel::joinable!(entity_photo_links -> entities (entity_id));
diesel::joinable!(entity_photo_links -> libraries (library_id));
diesel::joinable!(face_detections -> libraries (library_id));
diesel::joinable!(face_detections -> persons (person_id));
diesel::joinable!(image_exif -> libraries (library_id));
diesel::joinable!(insight_generation_jobs -> libraries (library_id));
diesel::joinable!(personas -> users (user_id));
diesel::joinable!(persons -> entities (entity_id));
diesel::joinable!(photo_insights -> libraries (library_id));
diesel::joinable!(tagged_photo -> tags (tag_id));
diesel::joinable!(video_preview_clips -> libraries (library_id));
diesel::allow_tables_to_appear_in_same_query!(
calendar_events,
daily_conversation_summaries,
entities,
entity_facts,
entity_photo_links,
face_detections,
favorites,
image_exif,
insight_generation_jobs,
libraries,
location_history,
persona_chat_conversations,
personas,
persons,
photo_insights,
precomputed_reels,
search_history,
tagged_photo,
tags,
user_ai_prefs,
users,
video_preview_clips,
);