Plan for automated database migration during sonarqube upgrades?

Hi All,

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
    Two Sonarqube 9.9.0 instances
  • how is SonarQube deployed: zip, Docker, Helm
    One instance deployed in kubernetes
    Another instance deployed using bitnami Helm charts
  • what are you trying to achieve
    I would like to know if there is any plans on automating database migration during sonarqube upgrade. Or if there is any way to do it already.
    So far the only way i found to do this is by opening /setup page and run.

One of the goal behind this demand is to be able to run an helm upgrade command without doing any further actions for sonarqube to be upgraded.
Also it would be easier for cicd automation to be able to upgrade sonarqube without extra manual actions.

Any advise is highly appreciated…

Hey there.

You may be able to orchestrate this using the Web API POST api/system/migrate_db (documentation linked in the footer of your instance).

Just out of curiosity
Is there any plans with sonarqube doing it automatically itself ? ( for community edition that is)
Even when doing an helm upgrade requires some sort of extra actions to run the db migrations.
Whether it is by opening /setup page or doing an api call.
I am fully aware that db migration is quite a touchy subject, but it would be more convinient if sonarqube does it itself automatically during an upgrade ( more specically by using helm upgrade )
We could consider some kind of kubernetes job that runs it for exemple.

Having it run automatically can be dangerous – for example if a newer SonarQube server (a test instance, for example) is accidentally started against the same database as an instance that isn’t meant to be upgraded yet.

As a result, this isn’t on our roadmap. In any case, I’ve moved your post to the right category so our PMs can take a look.