I’m trying to upgrade our SonarQube version to 9.8 but am running into database errors.
Fail to execute ALTER TABLE users DROP CONSTRAINT DF_users_sonarlint_1D7B6025
‘DF_users_sonarlint_1D7B6025’ is not a constraint
Things I tried:
multiple upgrades: 9.6 > 9.7 > 9.8 (in this order)
manually altering the table via SSMS
The only constraint in the constraint folder is: DF_users_active_6C6E1476.
you should update straight to Sonarqube 9.9.0 LTS + latest.
If your Sonarqube server runs with MSSQL, Sonarqube 9.9.0 has two fixes
I still get the same constraint error when trying to upgrade to 9.9.0.
We’re not wild about log screenshots here. They can be hard to read, among other reasons. Does your screenshot show the entire stacktrace? If not, can you copy/paste the log text starting from… about where your screenshot starts, at least through the end of the stacktrace?
Could you also provide what DB engine you’re using (Oracle, Postgres, …) and - if you remember - what your first version of SonarQube was?
access.log (1.8 MB)
es.log (4.3 KB)
sonar.log (2.8 KB)
SonarServiceWrapper.wrapper.log (64 Bytes)
web.log (11.0 KB)
Logs part 2
From the looks of it, version 8.4.2 was the first one.
Thanks. I’ve flagged this for the team.
Hi there, @pxiong,
Thank you for your question. We are investigating the issue, and would like to ask that you execute the following query on your DB:
SELECT d.name FROM sys.tables t
JOIN sys.default_constraints d ON d.parent_object_id = t.object_id
JOIN sys.columns c ON c.object_id = t.object_id AND c.column_id = d.parent_column_id
WHERE t.name = 'users' AND c.name in ('sonarlint_ad_seen')
Please send the response back to us and we will take it from there.
The result of the query:
Do you have any updates on this issue?
Hi again, @pxiong,
This is very strange. Are you sure that the DB user had permissions to ALTER table? We tried reproducing the issue and the migrations worked for us. If confirmed, could you try running the same ALTER TABLE sql manually in your DB using the same DB user as SonarQube, and then restart SonarQube?
@pxiong Hi again.
Were you able to figure the problem out?
Thanks for the tips but that did not fix the issue.
Am I able to install 9.9 and import the existing database?
What I’m referring to is installing 9.9 on a new server and hooking into the existing database.
This will not help, as you will still have an issue with the database.
Perhaps check the fragmentation of the indexes in your database, as you might need to reorganize them.