Migrate from MySQL to Postgres

Currently on SonarQube 6.7. Will be upgrading to 7.9 but want to migrate to Postgres first. We are using the community edition of SonarQube so the DB copy tool is not available to us. What are our other options?

Hi Jed,

We do offer a FOSS migrator. You’ll find the details here:

Hi. I’ve read through the migration instructions and I’m a bit confused about the following statements.

  • SonarQube version 6.7LTS to 7.8
    Note: Your source and target databases must be using the same version of SonarQube.
  • Currently using MySQL

Migrating your database

Warning: do not run migration on live SonarQube instances.

  1. Start then stop the same version of SonarQube that you’re running on your source database on your target database. For example, if you’re running SonarQube 7.3 on your source database, run then stop SonarQube 7.3 on your target database.

We are currently on 6.7.x and have both development and production Sonar instances. We obviously will be upgrading dev first. Since we are migrating from MySql to Postgres, we don’t yet have a Postgres instance so I’m not sure what you mean by source and target database. All we have is the source – the MySQL database. Does the migration tool actual create the Postgres database itself or only migrate the data? If the latter, then I assume we create the Postgres instance first, which would be considered the target and then run the migration tool to copy the data over. If my assumption is not correct, can you please clarify the migration process regarding what you mean by the target database.

Hello, you indeed need to create the postgreSQL database schema yourself. The SQ 6.7.X start&stop on that DB will create the tables SonarQube need. The migration tool only copy rows, that’s why you need to have the exact same database schema.

Thanks Pierre. One last question. How does simply stopping and starting Sonar 6.7 SQL Server DB create the Postgres schema? I imagine we have to do something first to force it to do that.

You need to create the schema yourself, with a tool or using sql query. Then you configure a SonarQube on it and start it, SonarQube will create the tables & index and insert some data.

As far as I know, you have to create a new instance and setup postgresql, sonarqube same version with the source one, then run a migration script.