From 79fd5378bc55b8ea527f785ee9a067067e6e8d88 Mon Sep 17 00:00:00 2001 From: Mrinal Chanshetty Date: Mon, 19 Oct 2026 20:05:20 -0700 Subject: [PATCH] fix(proxy): set lock_timeout on team_id migration and allow CONCURRENTLY in DROP INDEX check The team_id column migration runs a plain ALTER TABLE, so it now starts with SET LOCAL lock_timeout like the other recent migrations. test_drop_index_uses_if_exists rejected DROP INDEX CONCURRENTLY IF EXISTS; it now accepts an optional CONCURRENTLY, matching the CREATE INDEX check. --- .../20261017000000_daily_tag_spend_add_team_id/migration.sql | 2 ++ .../litellm_proxy_extras/test_litellm_proxy_extras_utils.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/litellm-proxy-extras/litellm_proxy_extras/migrations/20261017000000_daily_tag_spend_add_team_id/migration.sql b/litellm-proxy-extras/litellm_proxy_extras/migrations/20261017000000_daily_tag_spend_add_team_id/migration.sql index 1a8322fa254..0b73df2d05b 100644 --- a/litellm-proxy-extras/litellm_proxy_extras/migrations/20261017000000_daily_tag_spend_add_team_id/migration.sql +++ b/litellm-proxy-extras/litellm_proxy_extras/migrations/20261017000000_daily_tag_spend_add_team_id/migration.sql @@ -1,3 +1,5 @@ +SET LOCAL lock_timeout = '10s'; + -- Records the team that sent each request on its daily tag spend rows, so one tag used by -- several teams lands in one row per team. "" means the request had no team, and every row -- written before this migration keeps "" (attribution is not retroactive). diff --git a/tests/unit/litellm_proxy_extras/test_litellm_proxy_extras_utils.py b/tests/unit/litellm_proxy_extras/test_litellm_proxy_extras_utils.py index 02bdf3429ea..ad889af1873 100644 --- a/tests/unit/litellm_proxy_extras/test_litellm_proxy_extras_utils.py +++ b/tests/unit/litellm_proxy_extras/test_litellm_proxy_extras_utils.py @@ -435,7 +435,7 @@ class TestMigrationSQLIdempotency: for migration_name, sql in _guarded_migrations(all_migrations): for line_num, line in _statements(sql): if re.search(r"DROP\s+INDEX\s+", line, re.IGNORECASE) and not re.search( - r"DROP\s+INDEX\s+IF\s+EXISTS", line, re.IGNORECASE + r"DROP\s+INDEX\s+(?:CONCURRENTLY\s+)?IF\s+EXISTS", line, re.IGNORECASE ): violations.append(f" {migration_name}:{line_num}: {line.strip()}") assert (