mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
fix(coderd/database/migrations): resolve duplicate 000554 migration collision (#27581)
> 🤖 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
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user