From bd5d640f1e4ed8c607d6d00f7cc8392721ca8679 Mon Sep 17 00:00:00 2001 From: Jake Howell Date: Tue, 28 Jul 2026 21:35:36 +1000 Subject: [PATCH] fix(coderd/database/migrations): resolve duplicate 000554 migration collision (#27581) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit > 🤖 This PR was written by Coder Agents on behalf of Jake Howell. ## Problem `main` currently has **two migrations sharing version `000554`**: - `000554_aibridge_token_usage_spend_export_index.{up,down}.sql` - `000554_legacy_none_login_to_password.{up,down}.sql` (from #26851) Both merged around the same time. #26851 was renumbered to `000554` when `000553` was the latest, but `aibridge_token_usage_spend_export_index` claimed `000554` and merged too, leaving a duplicate version number on `main`. Duplicate migration versions break the migration sequence. ## Fix Renumber the legacy none login migration to the next free slot, `000555`, leaving the aibridge migration at `000554`: - `000554_legacy_none_login_to_password.{up,down}.sql` -> `000555_legacy_none_login_to_password.{up,down}.sql` - `migrate_test.go`: `TestMigration000554...` -> `TestMigration000555...`, `priorMigrationVersion` `553` -> `554`, and the `os.ReadFile` filename. The migration is data-only and unchanged; only its version number moves. `TestMigration000555LegacyNoneLoginToPassword` passes locally. The same collision exists on `release/2.36` via the backport (#27578), which has been renumbered to `000555` to match. Resolves [DEVEX-226] follow-up. [DEVEX-226]: https://linear.app/issue/DEVEX-226 --- ...wn.sql => 000555_legacy_none_login_to_password.down.sql} | 0 ...d.up.sql => 000555_legacy_none_login_to_password.up.sql} | 0 coderd/database/migrations/migrate_test.go | 6 +++--- 3 files changed, 3 insertions(+), 3 deletions(-) rename coderd/database/migrations/{000554_legacy_none_login_to_password.down.sql => 000555_legacy_none_login_to_password.down.sql} (100%) rename coderd/database/migrations/{000554_legacy_none_login_to_password.up.sql => 000555_legacy_none_login_to_password.up.sql} (100%) diff --git a/coderd/database/migrations/000554_legacy_none_login_to_password.down.sql b/coderd/database/migrations/000555_legacy_none_login_to_password.down.sql similarity index 100% rename from coderd/database/migrations/000554_legacy_none_login_to_password.down.sql rename to coderd/database/migrations/000555_legacy_none_login_to_password.down.sql diff --git a/coderd/database/migrations/000554_legacy_none_login_to_password.up.sql b/coderd/database/migrations/000555_legacy_none_login_to_password.up.sql similarity index 100% rename from coderd/database/migrations/000554_legacy_none_login_to_password.up.sql rename to coderd/database/migrations/000555_legacy_none_login_to_password.up.sql diff --git a/coderd/database/migrations/migrate_test.go b/coderd/database/migrations/migrate_test.go index f7f2ec7561..14119ed81e 100644 --- a/coderd/database/migrations/migrate_test.go +++ b/coderd/database/migrations/migrate_test.go @@ -1717,10 +1717,10 @@ func TestMigration000546ChatHistoryAPIKeyConstraints(t *testing.T) { } } -func TestMigration000554LegacyNoneLoginToPassword(t *testing.T) { +func TestMigration000555LegacyNoneLoginToPassword(t *testing.T) { t.Parallel() - const priorMigrationVersion = 553 + const priorMigrationVersion = 554 sqlDB := testSQLDB(t) @@ -1772,7 +1772,7 @@ func TestMigration000554LegacyNoneLoginToPassword(t *testing.T) { passwordID, "password-user", "password@test.com", []byte("hashed"), now, now, "active", pq.StringArray{}, "password", false, false) require.NoError(t, err) - migrationSQL, err := os.ReadFile("000554_legacy_none_login_to_password.up.sql") + migrationSQL, err := os.ReadFile("000555_legacy_none_login_to_password.up.sql") require.NoError(t, err) _, err = sqlDB.ExecContext(ctx, string(migrationSQL)) require.NoError(t, err)