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>
224 lines
5.3 KiB
Rust
224 lines
5.3 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,
|
|
}
|
|
}
|
|
|
|
diesel::table! {
|
|
entity_photo_links (id) {
|
|
id -> Integer,
|
|
entity_id -> Integer,
|
|
library_id -> Integer,
|
|
rel_path -> Text,
|
|
role -> Text,
|
|
}
|
|
}
|
|
|
|
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>,
|
|
}
|
|
}
|
|
|
|
diesel::table! {
|
|
libraries (id) {
|
|
id -> Integer,
|
|
name -> Text,
|
|
root_path -> Text,
|
|
created_at -> BigInt,
|
|
}
|
|
}
|
|
|
|
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! {
|
|
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>,
|
|
}
|
|
}
|
|
|
|
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,
|
|
}
|
|
}
|
|
|
|
diesel::table! {
|
|
tags (id) {
|
|
id -> Integer,
|
|
name -> Text,
|
|
created_time -> BigInt,
|
|
}
|
|
}
|
|
|
|
diesel::table! {
|
|
users (id) {
|
|
id -> Integer,
|
|
username -> Text,
|
|
password -> 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::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!(image_exif -> libraries (library_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,
|
|
favorites,
|
|
image_exif,
|
|
libraries,
|
|
location_history,
|
|
photo_insights,
|
|
search_history,
|
|
tagged_photo,
|
|
tags,
|
|
users,
|
|
video_preview_clips,
|
|
);
|