This is an automated email from the ASF dual-hosted git repository.
klesh pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/devlake.git
The following commit(s) were added to refs/heads/main by this push:
new 7f7cf09b0 fix(sonarqube): tolerate missing migration indexes (#9012)
7f7cf09b0 is described below
commit 7f7cf09b08eb2c3cce9efff1af448c53fbf9b63f
Author: Frederic Hübner <[email protected]>
AuthorDate: Mon Jul 27 08:48:30 2026 +0200
fix(sonarqube): tolerate missing migration indexes (#9012)
Co-authored-by: Frederic Hübner
<[email protected]>
---
backend/impls/dalgorm/dalgorm.go | 3 +++
.../plugins/sonarqube/e2e/issue_code_block_long_component_test.go | 6 ++++++
2 files changed, 9 insertions(+)
diff --git a/backend/impls/dalgorm/dalgorm.go b/backend/impls/dalgorm/dalgorm.go
index ba635355f..0445995fd 100644
--- a/backend/impls/dalgorm/dalgorm.go
+++ b/backend/impls/dalgorm/dalgorm.go
@@ -453,6 +453,9 @@ func (d *Dalgorm) RenameTable(oldName, newName string)
errors.Error {
// DropIndexes drops indexes for specified table
func (d *Dalgorm) DropIndexes(table string, indexNames ...string) errors.Error
{
for _, indexName := range indexNames {
+ if !d.db.Migrator().HasIndex(table, indexName) {
+ continue
+ }
err := d.db.Migrator().DropIndex(table, indexName)
if err != nil {
return d.convertGormError(err)
diff --git
a/backend/plugins/sonarqube/e2e/issue_code_block_long_component_test.go
b/backend/plugins/sonarqube/e2e/issue_code_block_long_component_test.go
index 8076fa3a8..e1a7d52b5 100644
--- a/backend/plugins/sonarqube/e2e/issue_code_block_long_component_test.go
+++ b/backend/plugins/sonarqube/e2e/issue_code_block_long_component_test.go
@@ -80,6 +80,12 @@ func TestSonarqubeIssueCodeBlockLongComponent(t *testing.T) {
&sonarqubeIssueCodeBlockBeforeText{},
&cqIssueCodeBlockBeforeText{},
))
+ require.NoError(t, dataflowTester.Db.Migrator().DropIndex(
+ "cq_issue_code_blocks", "idx_cq_issue_code_blocks_component",
+ ))
+ require.NoError(t, dataflowTester.Db.Migrator().DropIndex(
+ "_tool_sonarqube_issue_code_blocks",
"idx__tool_sonarqube_issue_code_blocks_component",
+ ))
existingComponent := "existing:component"
require.NoError(t,
dataflowTester.Db.Create(&sonarqubeIssueCodeBlockBeforeText{