Summary
A fresh MySQL installation can fail while applying the SonarQube and domain migrations at version 20260701000000 when the legacy component index is absent.
Dalgorm.DropIndexes unconditionally calls GORM's DropIndex, so MySQL aborts the migration with error 1091 instead of treating the already-absent index as the desired state.
Reproduction
- Start a fresh MySQL 8 database.
- Create the legacy
cq_issue_code_blocks and _tool_sonarqube_issue_code_blocks tables, then remove idx_cq_issue_code_blocks_component and idx__tool_sonarqube_issue_code_blocks_component.
- Apply both version
20260701000000 migrations that change component to text.
Actual result: the first migration attempts to drop the absent index and fails with Error 1091 (42000): Can't DROP 'idx_cq_issue_code_blocks_component'; check that column/key exists.
Expected result: migration is idempotent when an index is already absent, while present indexes continue to be dropped before the column becomes text.
Evidence
The targeted regression test TestSonarqubeIssueCodeBlockLongComponent reproduces the MySQL 1091 failure before the fix.
Summary
A fresh MySQL installation can fail while applying the SonarQube and domain migrations at version
20260701000000when the legacy component index is absent.Dalgorm.DropIndexesunconditionally calls GORM'sDropIndex, so MySQL aborts the migration with error 1091 instead of treating the already-absent index as the desired state.Reproduction
cq_issue_code_blocksand_tool_sonarqube_issue_code_blockstables, then removeidx_cq_issue_code_blocks_componentandidx__tool_sonarqube_issue_code_blocks_component.20260701000000migrations that changecomponenttotext.Actual result: the first migration attempts to drop the absent index and fails with
Error 1091 (42000): Can't DROP 'idx_cq_issue_code_blocks_component'; check that column/key exists.Expected result: migration is idempotent when an index is already absent, while present indexes continue to be dropped before the column becomes
text.Evidence
The targeted regression test
TestSonarqubeIssueCodeBlockLongComponentreproduces the MySQL 1091 failure before the fix.