Not Able to migrate the SonarQube DB (From older version to new version) - Mysql

SonarQube version:6.2
Database:MySQL , version:5.6.35 ,
Driver version:mysql-connector-java-5.1.39
URL:jdbc:mysql://localhost:3306/sonaruseUnicode=true&characterEncoding=utf8&rewriteBatchedStaements=true&useConfigs=maxPerformance

Trying to migrate the old DB to new DB.
We are given .sql script of old SonarQube DB , which we are trying to restore to new DB.
Above mentioned versions are of new SonarQube and DB.We have no information on the old version of SonarQube. We are unable to restore the old data because of schema differences.
SonarQube Schema differences are,
1)analysis_properties table is present in old
2)In ce_activity table, execution_count is the extra column in the old schema
3)active_rule_parameters data is more in old schema.
Kindly suggest the way out to restore the old DB with old schema to new one as we have to see the analysis trend.
I am manually comparing the two schema and see above differences.

Hi,

I guess a “.sql script” is a database backup? If so, simply restore it as-is. It’s SonarQube’s job to handle the database upgrades for you. What’s your starting version of SonarQube?

 
Ann

Hi,
Thank you for the reply. I have tried restoring DB and starting up SonarQube. However , it doesn’t come up.Unfortunately, I don’t know the earlier sonarQube version. Is there any way to get it from DB?

Hi,

In order to help you, could you please have a look in the SCHEMA_MIGRATIONS table and give us the highest value of the VERSION column ?

Thanks.

Hi Julien,

Thanks for your reply.
I am from the same team as Shubha. I have tried to restore the old DB and could see that highest value for VERSION in SCHEMA_MIGRATIONS table is 1838. There are around 493 rows in this table.

Thanks and Regards,
Sai

Ok, it means your database is currently in version 6.7

Thanks for the quick response.

For the working DB, we could see that the highest version in schema_migrations table is 1423. Can you please let us know if there is any way to bring up SONAR using the old DB (with highest version as 1838).

Thanks and Regards,
Sai

This DB is in 6.2. You should safely be able to migrate to 6.7

Thanks again :slight_smile:

Hey Julien,
The download page of sonarqube is always taking me to sonarqube 8.Is it ok to upgrade sonar from 6.2 to 8.00?

Hi,
Kindly let me know if it is fine to upgrade sonar from 6.2 to 8.0

Hi,

the support for MySql has been dropped with Sonarqube 7.9

Gilbert

In order to upgrade to 8.0, coming from 6.2 you must first upgrade to 6.7, then to 7.9 and eventually to 8.0.
See https://docs.sonarqube.org/latest/setup/upgrading/ for more info upgrade.

You will find the older versions of SonarQube scrolling down on this page: https://www.sonarqube.org/downloads/ (under Historical Downloads)

Thank you all :slight_smile:

Thanks a lot. I have upgraded sonar from 6.2 to 6.7. There are other issues related to code coverage data.I see that the recorded code coverage data is incorrect. Many test cases written using PowerMockito and TestNG are not considered for code coverage measure.could you help me resolve the same.