Skip to content

Commit

Permalink
SONAR-11962 Warn when detecting MySQL at startup
Browse files Browse the repository at this point in the history
  • Loading branch information
pierre-guillot-gh authored and SonarTech committed May 17, 2019
1 parent 259a95e commit 919604b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,14 @@ public String getSqlFromDual() {
public void init(DatabaseMetaData metaData) throws SQLException {
checkDbVersion(metaData, MIN_SUPPORTED_VERSION);

Loggers.get(getClass()).warn("MySQL support is deprecated and will be dropped soon.");
String message = "\n" +
"#############################################################################################################\n" +
"# End of Life of MySQL Support : SonarQube 7.8 is the last version that will support MySQL. #\n" +
"# Please consider migrating to a supported database. Get the migration detail on #\n" +
"# https://community.sonarsource.com/t/end-of-life-of-mysql-support #\n" +
"# and https://github.com/SonarSource/mysql-migrator #\n" +
"#############################################################################################################\n";

Loggers.get(getClass()).warn(message);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

import java.sql.DatabaseMetaData;
import java.sql.SQLException;
import java.util.List;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
Expand Down Expand Up @@ -99,7 +100,8 @@ public void init_does_not_fail_if_mysql_5_6() throws Exception {
public void init_logs_warning() throws SQLException {
underTest.init(newMetadata(5, 6));

assertThat(logs.logs(LoggerLevel.WARN)).contains("MySQL support is deprecated and will be dropped soon.");
List<String> logs = this.logs.logs(LoggerLevel.WARN);
assertThat(logs.get(0).contains("End of Life of MySQL Support : SonarQube 7.8 is the last version that will support MySQL.")).isTrue();
}

@Test
Expand Down

0 comments on commit 919604b

Please sign in to comment.