From 2fca49b120fd6d06271cc856d8201a9f35ecaa57 Mon Sep 17 00:00:00 2001 From: Accusys Date: Fri, 30 Oct 2026 22:47:16 +0800 Subject: [PATCH] fix: update tkg_nodes.label when face_track node already exists - ensure_face_track_node now UPDATEs label instead of returning early - Fixes rename persistence - names are now stored in database - Enables consistent names across all access points (localhost, DDNS) --- src/core/db/schema.rs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/core/db/schema.rs b/src/core/db/schema.rs index 92719e64..f0531e7d 100644 --- a/src/core/db/schema.rs +++ b/src/core/db/schema.rs @@ -133,8 +133,17 @@ pub async fn ensure_face_track_node( .fetch_optional(pool) .await?; - if existing.is_some() { - return Ok(0); + if let Some((node_id,)) = existing { + // Node exists - update the label + let res = sqlx::query(&format!( + "UPDATE {tkg_table} SET label = $1, properties = $2 WHERE id = $3" + )) + .bind(name) + .bind(&props) + .bind(node_id) + .execute(pool) + .await?; + return Ok(res.rows_affected()); } let sql = format!(