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:
Accusys
2026-05-14 14:40:14 +08:00
parent 261d134fee
commit 301a95e2bc
14 changed files with 184 additions and 139 deletions

View File

@@ -324,9 +324,10 @@ async fn trace_video(
let pad_frames = (padding * fps) as i32;
// Query identity info for this trace
let identities_table = schema::table_name("identities");
let identity_name: String = sqlx::query_scalar(&format!(
"SELECT COALESCE(i.name, 'unknown') FROM {} fd LEFT JOIN dev.identities i ON i.id = fd.identity_id WHERE fd.file_uuid = $1 AND fd.trace_id = $2 LIMIT 1",
face_table
"SELECT COALESCE(i.name, 'unknown') FROM {} fd LEFT JOIN {} i ON i.id = fd.identity_id WHERE fd.file_uuid = $1 AND fd.trace_id = $2 LIMIT 1",
face_table, identities_table
))
.bind(&file_uuid).bind(trace_id)
.fetch_optional(state.db.pool()).await
@@ -334,8 +335,9 @@ async fn trace_video(
.unwrap_or_else(|| "unknown".to_string());
// Query cut_id for the first frame
let cut_table = schema::table_name("cut");
let cut_id: i32 = sqlx::query_scalar(
"SELECT scene_number FROM public.cut WHERE file_uuid = $1 AND start_frame <= $2 AND end_frame >= $2 LIMIT 1"
&format!("SELECT scene_number FROM {} WHERE file_uuid = $1 AND start_frame <= $2 AND end_frame >= $2 LIMIT 1", cut_table)
)
.bind(&file_uuid).bind(first_frame)
.fetch_optional(state.db.pool()).await