fix(repository): add missing name column in find_network query

The sed replacement during the network name feature didn't update
find_network's SELECT, causing a ColumnNotFound panic on host creation.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-16 01:55:35 +02:00
parent 6018874aa4
commit df6aecef51

View File

@@ -23,7 +23,7 @@ pub async fn list_networks(pool: &AnyPool) -> Result<Vec<Network>, DbError> {
pub async fn find_network(pool: &AnyPool, id: i64) -> Result<Option<Network>, DbError> { pub async fn find_network(pool: &AnyPool, id: i64) -> Result<Option<Network>, DbError> {
// `fetch_optional` returns `Ok(None)` when no row matches — unlike // `fetch_optional` returns `Ok(None)` when no row matches — unlike
// `fetch_one`, which returns an error when nothing is found. // `fetch_one`, which returns an error when nothing is found.
let row = sqlx::query("SELECT id, cidr FROM networks WHERE id = $1") let row = sqlx::query("SELECT id, name, cidr FROM networks WHERE id = $1")
.bind(id) // `$1` is replaced with the value of `id` at runtime .bind(id) // `$1` is replaced with the value of `id` at runtime
.fetch_optional(pool) .fetch_optional(pool)
.await?; .await?;