From 8d83d9f2174212d0a8ffb7fa1ad1d9ceace80815 Mon Sep 17 00:00:00 2001 From: Accusys Date: Sat, 8 Aug 2026 17:35:23 +0800 Subject: [PATCH] fix: replace dev schema defaults with public - schema.rs: Change DATABASE_SCHEMA default from 'dev' to 'public' - rule2_ingest.rs, files.rs, tools.rs, scan.rs: Same schema default fix - files.rs, watcher.rs, processing.rs: Change output_dev to output - identities.rs: Change API schema parameter default from 'dev' to 'public' - postgres_db.rs: Add face_settings column to SELECT query (fix ColumnIndexOutOfBounds panic) This fixes worker not processing jobs due to missing dev schema. --- src/api/files.rs | 12 ++++++------ src/api/identities.rs | 2 +- src/api/processing.rs | 6 +++--- src/api/scan.rs | 2 +- src/core/agent/tools.rs | 2 +- src/core/chunk/rule2_ingest.rs | 2 +- src/core/db/postgres_db.rs | 4 ++-- src/core/db/schema.rs | 2 +- src/watcher/watcher.rs | 4 ++-- 9 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/api/files.rs b/src/api/files.rs index 69afc842..7b186554 100644 --- a/src/api/files.rs +++ b/src/api/files.rs @@ -261,7 +261,7 @@ async fn register_single_file( }; let output_dir = std::env::var("MOMENTRY_OUTPUT_DIR") - .unwrap_or_else(|_| "/Users/accusys/momentry/output_dev".to_string()); + .unwrap_or_else(|_| "/Users/accusys/momentry/output".to_string()); let birthday = std::fs::metadata(&path) .ok() @@ -512,7 +512,7 @@ async fn register_single_file( let mut cut_done = false; if has_video && total_frames > 0 && fps > 0.0 { let output_dir = std::env::var("MOMENTRY_OUTPUT_DIR") - .unwrap_or_else(|_| "/Users/accusys/momentry/output_dev".to_string()); + .unwrap_or_else(|_| "/Users/accusys/momentry/output".to_string()); let scripts_dir = std::env::var("MOMENTRY_SCRIPTS_DIR") .unwrap_or_else(|_| "/Users/accusys/momentry_core_0.1/scripts".to_string()); let python_path = std::env::var("MOMENTRY_PYTHON_PATH") @@ -579,7 +579,7 @@ async fn register_single_file( let audio_tracks_json = serde_json::to_value(&audio_tracks).ok(); let cut_path = std::path::Path::new( &std::env::var("MOMENTRY_OUTPUT_DIR") - .unwrap_or_else(|_| "/Users/accusys/momentry/output_dev".to_string()), + .unwrap_or_else(|_| "/Users/accusys/momentry/output".to_string()), ) .join(format!("{}.cut.json", file_uuid)); let mut cut_count = 0i32; @@ -612,7 +612,7 @@ async fn register_single_file( if let Some(json_val) = probe_json { let probe_path = std::path::Path::new( &std::env::var("MOMENTRY_OUTPUT_DIR") - .unwrap_or_else(|_| "/Users/accusys/momentry/output_dev".to_string()), + .unwrap_or_else(|_| "/Users/accusys/momentry/output".to_string()), ) .join(format!("{}.probe.json", file_uuid)); let json_str = serde_json::to_string_pretty(&json_val).unwrap_or_default(); @@ -1062,7 +1062,7 @@ fn delete_output_files(uuid: &str) -> u64 { let mut deleted_count = 0u64; let output_dirs = [ config::OUTPUT_DIR.to_string(), - "/Users/accusys/momentry/output_dev".to_string(), + "/Users/accusys/momentry/output".to_string(), "/Users/accusys/momentry/output".to_string(), ]; @@ -1601,7 +1601,7 @@ async fn unregister_internal(state: &AppState, uuid: &str) -> Result<(), StatusC ) .await; // Delete from speaker collection - let schema = std::env::var("DATABASE_SCHEMA").unwrap_or_else(|_| "dev".to_string()); + let schema = std::env::var("DATABASE_SCHEMA").unwrap_or_else(|_| "public".to_string()); let speaker_collection = if schema == "public" { "momentry_public_speaker" } else { diff --git a/src/api/identities.rs b/src/api/identities.rs index e3abebd7..cf41c7a6 100644 --- a/src/api/identities.rs +++ b/src/api/identities.rs @@ -43,7 +43,7 @@ async fn create_identity( State(_state): State, Json(req): Json, ) -> Result, (StatusCode, String)> { - let schema = req.schema.unwrap_or("dev".to_string()); + let schema = req.schema.unwrap_or("public".to_string()); let python_path = std::env::var("MOMENTRY_PYTHON_PATH").unwrap_or("/opt/homebrew/bin/python3.11".to_string()); diff --git a/src/api/processing.rs b/src/api/processing.rs index 7d34430b..128f5346 100644 --- a/src/api/processing.rs +++ b/src/api/processing.rs @@ -223,7 +223,7 @@ async fn trigger_processing( } let output_dir = std::env::var("MOMENTRY_OUTPUT_DIR") - .unwrap_or_else(|_| "/Users/accusys/momentry/output_dev".to_string()); + .unwrap_or_else(|_| "/Users/accusys/momentry/output".to_string()); let output_path = std::path::Path::new(&output_dir).join(format!("{}.monitor.json", file_uuid)); @@ -375,7 +375,7 @@ async fn download_json( Path((file_uuid, processor)): Path<(String, String)>, ) -> Result, StatusCode> { let output_dir = std::env::var("MOMENTRY_OUTPUT_DIR") - .unwrap_or_else(|_| "/Users/accusys/momentry/output_dev".to_string()); + .unwrap_or_else(|_| "/Users/accusys/momentry/output".to_string()); let path = std::path::Path::new(&output_dir).join(format!("{}.{}.json", file_uuid, processor)); let content = tokio::fs::read_to_string(&path) .await @@ -723,7 +723,7 @@ async fn get_processor_counts( let file_uuid = full_uuid.ok_or(StatusCode::NOT_FOUND)?; let output_dir = std::env::var("MOMENTRY_OUTPUT_DIR") - .unwrap_or_else(|_| "/Users/accusys/momentry/output_dev".to_string()); + .unwrap_or_else(|_| "/Users/accusys/momentry/output".to_string()); let processors = crate::core::db::ProcessorType::all(); let mut results = Vec::new(); diff --git a/src/api/scan.rs b/src/api/scan.rs index f1dc5fab..66558167 100644 --- a/src/api/scan.rs +++ b/src/api/scan.rs @@ -938,7 +938,7 @@ async fn get_file_stats( } // Text chunk stats (rule1 collection) - let schema = std::env::var("DATABASE_SCHEMA").unwrap_or_else(|_| "dev".to_string()); + let schema = std::env::var("DATABASE_SCHEMA").unwrap_or_else(|_| "public".to_string()); let rule1_collection = if schema == "public" { "momentry_rule1".to_string() } else { diff --git a/src/core/agent/tools.rs b/src/core/agent/tools.rs index 0450edbc..20e9b1c0 100644 --- a/src/core/agent/tools.rs +++ b/src/core/agent/tools.rs @@ -9,7 +9,7 @@ use crate::core::llm::function_calling::call_llm_vision; use crate::core::processor::tkg::query_auto_representative_frame; fn t(name: &str) -> String { - let schema = std::env::var("DATABASE_SCHEMA").unwrap_or_else(|_| "dev".to_string()); + let schema = std::env::var("DATABASE_SCHEMA").unwrap_or_else(|_| "public".to_string()); if schema == "public" { name.to_string() } else { diff --git a/src/core/chunk/rule2_ingest.rs b/src/core/chunk/rule2_ingest.rs index 82371dbd..2247b1ab 100644 --- a/src/core/chunk/rule2_ingest.rs +++ b/src/core/chunk/rule2_ingest.rs @@ -7,7 +7,7 @@ use std::sync::Arc; use tracing::{info, warn}; fn t(name: &str) -> String { - let schema = std::env::var("DATABASE_SCHEMA").unwrap_or_else(|_| "dev".to_string()); + let schema = std::env::var("DATABASE_SCHEMA").unwrap_or_else(|_| "public".to_string()); if schema == "public" { name.to_string() } else { diff --git a/src/core/db/postgres_db.rs b/src/core/db/postgres_db.rs index 1db92772..97338347 100644 --- a/src/core/db/postgres_db.rs +++ b/src/core/db/postgres_db.rs @@ -2098,7 +2098,7 @@ impl PostgresDb { let row = sqlx::query( &format!( r#" - SELECT id, uuid, video_path, status, current_processor, progress_total, progress_current, error_count, last_error, started_at::TEXT, updated_at::TEXT, created_at::TEXT, processors, completed_processors, failed_processors, video_id + SELECT id, uuid, video_path, status, current_processor, progress_total, progress_current, error_count, last_error, started_at::TEXT, updated_at::TEXT, created_at::TEXT, processors, completed_processors, failed_processors, video_id, face_settings::TEXT FROM {} WHERE uuid = $1 "#, table @@ -2145,7 +2145,7 @@ impl PostgresDb { let rows = sqlx::query( &format!( r#" - SELECT id, uuid, video_path, status, current_processor, progress_total, progress_current, error_count, last_error, started_at::TEXT, updated_at::TEXT, created_at::TEXT, processors, completed_processors, failed_processors, video_id + SELECT id, uuid, video_path, status, current_processor, progress_total, progress_current, error_count, last_error, started_at::TEXT, updated_at::TEXT, created_at::TEXT, processors, completed_processors, failed_processors, video_id, face_settings::TEXT FROM {} WHERE status = $1 ORDER BY created_at ASC "#, table diff --git a/src/core/db/schema.rs b/src/core/db/schema.rs index 95079e65..add47d65 100644 --- a/src/core/db/schema.rs +++ b/src/core/db/schema.rs @@ -8,7 +8,7 @@ pub fn t(name: &str) -> String { /// Alias for t() - used by postgres_db.rs pub fn table_name(name: &str) -> String { - let schema = std::env::var("DATABASE_SCHEMA").unwrap_or_else(|_| "dev".to_string()); + let schema = std::env::var("DATABASE_SCHEMA").unwrap_or_else(|_| "public".to_string()); if schema == "public" { name.to_string() } else { diff --git a/src/watcher/watcher.rs b/src/watcher/watcher.rs index 2e6d94b2..0163d05f 100644 --- a/src/watcher/watcher.rs +++ b/src/watcher/watcher.rs @@ -93,7 +93,7 @@ async fn auto_register_file(file_path: &str) { }; let output_dir = std::env::var("MOMENTRY_OUTPUT_DIR") - .unwrap_or_else(|_| "/Users/accusys/momentry/output_dev".to_string()); + .unwrap_or_else(|_| "/Users/accusys/momentry/output".to_string()); let pre_path = std::path::PathBuf::from(&output_dir).join(format!("{}.pre.json", file_uuid)); let pre_content = match std::fs::read_to_string(&pre_path) { Ok(c) => c, @@ -207,7 +207,7 @@ pub async fn pre_process_file(file_path: &str) -> Option { let filename = path.file_name()?.to_string_lossy().to_string(); let output_dir = std::env::var("MOMENTRY_OUTPUT_DIR") - .unwrap_or_else(|_| "/Users/accusys/momentry/output_dev".to_string()); + .unwrap_or_else(|_| "/Users/accusys/momentry/output".to_string()); let birthday = std::fs::metadata(&path) .ok()