From c0284ea356016f563e74fd7d70ca78f191cb1bbf Mon Sep 17 00:00:00 2001 From: Ruben Fiszel Date: Thu, 14 Sep 2023 11:44:36 +0200 Subject: [PATCH] fix migraiton --- backend/windmill-api/src/jobs.rs | 6 +++--- backend/windmill-queue/src/jobs.rs | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/backend/windmill-api/src/jobs.rs b/backend/windmill-api/src/jobs.rs index 7e1d505fd4..e65b1d8759 100644 --- a/backend/windmill-api/src/jobs.rs +++ b/backend/windmill-api/src/jobs.rs @@ -396,7 +396,7 @@ pub struct CompletedJob<'rows> { pub created_by: String, pub created_at: chrono::DateTime, pub started_at: chrono::DateTime, - pub duration_ms: i32, + pub duration_ms: i64, pub success: bool, #[serde(skip_serializing_if = "Option::is_none")] pub script_hash: Option, @@ -453,7 +453,7 @@ pub struct ListableCompletedJob { pub created_by: String, pub created_at: chrono::DateTime, pub started_at: chrono::DateTime, - pub duration_ms: i32, + pub duration_ms: i64, pub success: bool, #[serde(skip_serializing_if = "Option::is_none")] pub script_hash: Option, @@ -1348,7 +1348,7 @@ struct UnifiedJob { running: Option, script_hash: Option, script_path: Option, - duration_ms: Option, + duration_ms: Option, success: Option, deleted: bool, canceled: bool, diff --git a/backend/windmill-queue/src/jobs.rs b/backend/windmill-queue/src/jobs.rs index 64a752ef47..5f32f973d1 100644 --- a/backend/windmill-queue/src/jobs.rs +++ b/backend/windmill-queue/src/jobs.rs @@ -1026,8 +1026,8 @@ pub async fn pull( let job_uuid: Uuid = pulled_job.id; let min_started_at: Option> = script_path_live_stats.min_started_at; - let avg_script_duration: Option = sqlx::query_scalar!( - "SELECT CAST(ROUND(AVG(duration_ms) / 1000, 0) AS INT) AS avg_duration_s FROM + let avg_script_duration: Option = sqlx::query_scalar!( + "SELECT CAST(ROUND(AVG(duration_ms) / 1000, 0) AS BIGINT) AS avg_duration_s FROM (SELECT duration_ms FROM completed_job WHERE script_path = $1 ORDER BY started_at DESC LIMIT 10) AS t",