refactor: remove all dev.* and public.* schema hardcodes from runtime code
14 files updated to use schema::table_name() instead of hardcoded schema prefixes. Only src/bin/release.rs intentionally retains dev.* references.
This commit is contained in:
@@ -4,6 +4,8 @@ use sqlx::PgPool;
|
||||
use std::path::Path;
|
||||
use tracing::info;
|
||||
|
||||
use crate::core::db::schema;
|
||||
|
||||
/// Heuristic scene metadata derived from YOLO + Face + luminance data.
|
||||
/// Runs as a post-processing trigger, not a standalone processor.
|
||||
/// Replaces the removed Places365 Scene classifier.
|
||||
@@ -110,12 +112,13 @@ pub async fn build_heuristic_scene_meta(
|
||||
}
|
||||
|
||||
// Get face counts grouped by frame
|
||||
let fd_table = schema::table_name("face_detections");
|
||||
let face_rows: Vec<(i64, i64)> = sqlx::query_as(
|
||||
"SELECT frame_number, COUNT(*) as fc \
|
||||
FROM dev.face_detections \
|
||||
&format!("SELECT frame_number, COUNT(*) as fc \
|
||||
FROM {} \
|
||||
WHERE file_uuid = $1 AND frame_number IS NOT NULL \
|
||||
GROUP BY frame_number \
|
||||
ORDER BY frame_number",
|
||||
ORDER BY frame_number", fd_table),
|
||||
)
|
||||
.bind(file_uuid)
|
||||
.fetch_all(pool)
|
||||
@@ -255,8 +258,9 @@ pub async fn generate_scene_meta(db: &crate::core::db::PostgresDb, file_uuid: &s
|
||||
.collect()
|
||||
} else {
|
||||
// Fallback: query DB for video duration, make one segment
|
||||
let videos_table = schema::table_name("videos");
|
||||
let (total_frames, duration): (Option<i64>, Option<f64>) = sqlx::query_as(
|
||||
"SELECT total_frames, duration FROM dev.videos WHERE file_uuid = $1",
|
||||
&format!("SELECT total_frames, duration FROM {} WHERE file_uuid = $1", videos_table),
|
||||
)
|
||||
.bind(file_uuid)
|
||||
.fetch_optional(pool)
|
||||
|
||||
Reference in New Issue
Block a user