From e33241da5afb85fa462e6079a42a98f97a704c3d Mon Sep 17 00:00:00 2001 From: Ruben Fiszel Date: Sat, 28 Feb 2026 17:24:53 +0000 Subject: [PATCH] chore: add SKIP_MIN_VERSION_CHECK env var and database URL docs Co-Authored-By: Claude Opus 4.5 --- CLAUDE.md | 9 +++++++-- backend/windmill-api/src/live_migrations.rs | 19 ++++++++++++++----- 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/CLAUDE.md b/CLAUDE.md index 7a5c365101..3f320973fd 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -51,10 +51,15 @@ After making code changes, you MUST run the appropriate checks and fix all error `backend/summarized_schema.txt` provides a compact overview of all tables, columns, types, ENUMs, and foreign keys. Use it to quickly understand the data model and relationships. Note: this file is a simplified summary — it omits indexes, constraints details, and other metadata. -For exact table definitions (indexes, constraints, column defaults, etc.), query the database directly: +For exact table definitions (indexes, constraints, column defaults, etc.), query the database directly. + +**IMPORTANT**: The database name varies per worktree/branch. Always read `.env.local` first to get the correct `DATABASE_URL`. The default `windmill` database is only used on the main branch — worktrees use branch-specific database names (e.g., `windmill_add_fast_filter`). Using the wrong database means your queries, inserts, and migrations will target stale or empty data. ```bash -psql postgres://postgres:changeme@localhost:5432/windmill +# Always check .env.local first: +grep DATABASE_URL .env.local +# Then use the correct database URL, e.g.: +psql "postgres://postgres:changeme@127.0.0.1:5432/windmill_add_fast_filter" ``` Useful psql commands: diff --git a/backend/windmill-api/src/live_migrations.rs b/backend/windmill-api/src/live_migrations.rs index 76748e828a..b926f51115 100644 --- a/backend/windmill-api/src/live_migrations.rs +++ b/backend/windmill-api/src/live_migrations.rs @@ -101,12 +101,21 @@ async fn fast_filter_migration(db: &DB) -> Result<(), Error> { async fn fast_filter_migration_inner(db: &DB) -> Result<(), Error> { // Wait until all workers are at least version 1.647 so new jobs write fast_filter - loop { - if MIN_VERSION_IS_AT_LEAST_1_647.met().await { - break; + let skip_version_check = std::env::var("SKIP_MIN_VERSION_CHECK") + .map(|v| v == "1" || v == "true") + .unwrap_or(false); + if !skip_version_check { + loop { + if MIN_VERSION_IS_AT_LEAST_1_647.met().await { + break; + } + tracing::info!("fast_filter migration: waiting for all workers to be >= 1.647"); + tokio::time::sleep(std::time::Duration::from_secs(30)).await; } - tracing::info!("fast_filter migration: waiting for all workers to be >= 1.647"); - tokio::time::sleep(std::time::Duration::from_secs(30)).await; + } else { + tracing::info!( + "fast_filter migration: skipping version check (SKIP_MIN_VERSION_CHECK=true)" + ); } // Backfill existing rows in batches (skip skipped jobs — they stay NULL)