From 2c7432f2ec06b0c8db4591c8aeb16f4afab8a7ea Mon Sep 17 00:00:00 2001 From: Echo Date: Mon, 18 May 2026 01:31:20 +0000 Subject: [PATCH] fix: cast ip_address to inet on insert and to text on read for enrollment_requests --- crates/pm-core/src/db.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/pm-core/src/db.rs b/crates/pm-core/src/db.rs index 28513ae..b5fcdb1 100644 --- a/crates/pm-core/src/db.rs +++ b/crates/pm-core/src/db.rs @@ -74,7 +74,7 @@ pub async fn create_enrollment_request( r#" INSERT INTO enrollment_requests (machine_id, fqdn, ip_address, os_details, polling_token) VALUES ($1, $2, $3::inet, $4, $5) - RETURNING id, machine_id, fqdn, ip_address, os_details, polling_token, created_at, expires_at + RETURNING id, machine_id, fqdn, ip_address::text, os_details, polling_token, created_at, expires_at "#, ) .bind(req.machine_id) @@ -90,7 +90,7 @@ pub async fn list_enrollment_requests( pool: &PgPool, ) -> Result, sqlx::Error> { sqlx::query_as::<_, EnrollmentRequest>( - "SELECT id, machine_id, fqdn, ip_address, os_details, polling_token, created_at, expires_at FROM enrollment_requests ORDER BY created_at DESC", + "SELECT id, machine_id, fqdn, ip_address::text, os_details, polling_token, created_at, expires_at FROM enrollment_requests ORDER BY created_at DESC", ) .fetch_all(pool) .await