From 4de2dd6d593d3400044e788c10d2fb82248e66fc Mon Sep 17 00:00:00 2001 From: Diego Imbert Date: Wed, 17 Jun 2026 18:34:52 +0200 Subject: [PATCH] feat: support running a single specific datatable migration --- backend/windmill-api-workspaces/src/workspaces.rs | 13 +++++++++++-- backend/windmill-api/openapi.yaml | 7 +++++++ 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/backend/windmill-api-workspaces/src/workspaces.rs b/backend/windmill-api-workspaces/src/workspaces.rs index ad8df9fcfb..2604734108 100644 --- a/backend/windmill-api-workspaces/src/workspaces.rs +++ b/backend/windmill-api-workspaces/src/workspaces.rs @@ -2413,6 +2413,10 @@ struct RunDatatableMigrationsResult { struct RunDatatableMigrationsQuery { /// When set, only apply pending migrations up to and including this version. up_to: Option, + /// When set, apply only this specific migration version (if not already + /// applied), ignoring any other pending migrations. Takes precedence over + /// `up_to`. + only: Option, } /// Apply the workspace's pending data table migrations to a given data table. @@ -2478,8 +2482,13 @@ async fn run_datatable_migrations( let mut applied = Vec::new(); for m in migrations { - // Migrations are ordered ascending, so once we pass `up_to` we're done. - if query.up_to.is_some_and(|up_to| m.timestamp > up_to) { + if let Some(only) = query.only { + // Run a single specific migration, skipping every other one. + if m.timestamp != only { + continue; + } + } else if query.up_to.is_some_and(|up_to| m.timestamp > up_to) { + // Migrations are ordered ascending, so once we pass `up_to` we're done. break; } if applied_versions.contains(&m.timestamp) { diff --git a/backend/windmill-api/openapi.yaml b/backend/windmill-api/openapi.yaml index df21148cd0..54356bf007 100644 --- a/backend/windmill-api/openapi.yaml +++ b/backend/windmill-api/openapi.yaml @@ -4371,6 +4371,13 @@ paths: schema: type: integer format: int64 + - name: only + in: query + required: false + description: apply only this specific migration version, ignoring others + schema: + type: integer + format: int64 responses: "200": description: applied migrations