Possible db migration error when updating to Sonarqube Enterprise 9.8.0 with MSSQL


just a hint for other users that might hit this problem and to relieve the Sonarsource support a little bit.
Our Sonarqube instance runs on Windows Server 2019 with a MSSQL 2017 database.
We’ve started with Sonarqube Enterprise 5.6 in 2016, then updated to the first
Sonarqube 6.x LTS and afterwards switched to always use latest with Sonarqube 7.x onwards.

The update from Sonarqube Enterprise 9.7.1 to 9.8.0 ran into a db migration error.

org.sonar.server.platform.db.migration.step.MigrationStepExecutionException: Execution of migration step #6703 'Drop project measure variation column' failed
Caused by: java.lang.IllegalStateException: Fail to execute ALTER TABLE project_measures DROP COLUMN variation_value_1
Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: Objekt "DF_project_m_ varia_4D94879B" ist von Spalte "variation_value_1" abhängig.

We’ve hit similar db migration errors with an early Sonarqube 8.x version, this only affected users with MSSQL and a longer upgrade path.

The Sonarsource support recommended to run this query

 select d.name as consraint_name, t.name as table_name, c.name as column_name
      from sys.all_columns c
      join sys.tables t on t.object_id = c.object_id
      join sys.schemas s on s.schema_id = t.schema_id
      join sys.default_constraints d on c.default_object_id = d.object_id where d.name like '%DF__project_m__varia__4D94879B%'

then delete the constraint manually via

ALTER TABLE dbo.project_measures
DROP CONSTRAINT DF_project_m_varia_4D94879B;

and try the update again.
This worked, not clear if a patched Sonarqube 9.8.x will be released.



Thanks @Rebse! It seems like this only affects users with a long upgrade history (similar to the issue faced in v8.x).

No news on a patch yet, and I imagine we’ll have more news on that after the holidays. SQL Server users who got their start on/after v6.7 LTS shouldn’t be affected.

According to
and more general
this is fixed for Sonarqube 9.9



Followup, updated both our Sonarqube Enterprise (running with MSSQL) test installations today.

Test 1
9.8.0 (after the manual DB patch, mentioned above) > 9.9.0
Test 2
9.7.1 (running and updated since 5.6) > 9.9.0

and the DB migration ran smooth.

Note =
mssql-jdbc-auth has to be updated to mssql-jdbc_auth-11.2.2.x64.dll, as Sonarqube
now ships with mssql-jdbc-11.2.2.jre17.jar and - as this filename already reveals -
Sonarqube runs on Java 17 now, Java 11 doesn’t work anymore.


1 Like