aboutsummaryrefslogtreecommitdiffstats
path: root/server
diff options
context:
space:
mode:
authorlukasz-jarocki-sonarsource <lukasz.jarocki@sonarsource.com>2024-08-20 11:42:12 +0200
committersonartech <sonartech@sonarsource.com>2024-08-20 20:02:56 +0000
commit18368ef34d3a5ed844a6c0645e035e665f7a39c8 (patch)
tree2a1fa9a27a820f2dcf82dd6be799ac2b40c3b0cf /server
parent8c468972d855a3de2c85537a4cae1adaeca2ca7f (diff)
downloadsonarqube-18368ef34d3a5ed844a6c0645e035e665f7a39c8.tar.gz
sonarqube-18368ef34d3a5ed844a6c0645e035e665f7a39c8.zip
SONAR-22521 fixed the issue where sometimes the upgrade warning text was not clear to the users
Diffstat (limited to 'server')
-rw-r--r--server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/DatabaseVersion.java2
-rw-r--r--server/sonar-webserver-core/src/main/java/org/sonar/server/platform/DatabaseServerCompatibility.java4
-rw-r--r--server/sonar-webserver-core/src/test/java/org/sonar/server/platform/DatabaseServerCompatibilityTest.java2
3 files changed, 6 insertions, 2 deletions
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/DatabaseVersion.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/DatabaseVersion.java
index 4359efb47b3..7472fa89545 100644
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/DatabaseVersion.java
+++ b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/DatabaseVersion.java
@@ -31,6 +31,8 @@ public class DatabaseVersion {
* Note that the value can't be less than current LTA version.
*/
public static final long MIN_UPGRADE_VERSION = 6_802;
+ public static final String MIN_UPGRADE_VERSION_HUMAN_READABLE = "9.9";
+
private final MigrationSteps migrationSteps;
private final MigrationHistory migrationHistory;
diff --git a/server/sonar-webserver-core/src/main/java/org/sonar/server/platform/DatabaseServerCompatibility.java b/server/sonar-webserver-core/src/main/java/org/sonar/server/platform/DatabaseServerCompatibility.java
index 63ec4321e42..2d719224553 100644
--- a/server/sonar-webserver-core/src/main/java/org/sonar/server/platform/DatabaseServerCompatibility.java
+++ b/server/sonar-webserver-core/src/main/java/org/sonar/server/platform/DatabaseServerCompatibility.java
@@ -27,6 +27,7 @@ import org.sonar.api.utils.MessageException;
import org.sonar.server.platform.db.migration.version.DatabaseVersion;
import static org.sonar.server.log.ServerProcessLogging.STARTUP_LOGGER_NAME;
+import static org.sonar.server.platform.db.migration.version.DatabaseVersion.MIN_UPGRADE_VERSION_HUMAN_READABLE;
public class DatabaseServerCompatibility implements Startable {
@@ -48,7 +49,8 @@ public class DatabaseServerCompatibility implements Startable {
if (status == DatabaseVersion.Status.REQUIRES_UPGRADE) {
Optional<Long> currentVersion = this.version.getVersion();
if (currentVersion.isPresent() && currentVersion.get() < DatabaseVersion.MIN_UPGRADE_VERSION) {
- throw MessageException.of("The version of SonarQube is too old. Please upgrade to the Long-Term Active version first.");
+ throw MessageException.of("The version of SonarQube you are trying to upgrade from is too old. Please upgrade to the " +
+ MIN_UPGRADE_VERSION_HUMAN_READABLE + " Long-Term Active version first.");
}
String msg = "The database must be manually upgraded. Please backup the database and browse /setup. "
diff --git a/server/sonar-webserver-core/src/test/java/org/sonar/server/platform/DatabaseServerCompatibilityTest.java b/server/sonar-webserver-core/src/test/java/org/sonar/server/platform/DatabaseServerCompatibilityTest.java
index 022bc4716ee..ef892451ab6 100644
--- a/server/sonar-webserver-core/src/test/java/org/sonar/server/platform/DatabaseServerCompatibilityTest.java
+++ b/server/sonar-webserver-core/src/test/java/org/sonar/server/platform/DatabaseServerCompatibilityTest.java
@@ -56,7 +56,7 @@ public class DatabaseServerCompatibilityTest {
var compatibility = new DatabaseServerCompatibility(version);
assertThatThrownBy(compatibility::start)
.isInstanceOf(MessageException.class)
- .hasMessage("The version of SonarQube is too old. Please upgrade to the Long-Term Active version first.");
+ .hasMessage("The version of SonarQube you are trying to upgrade from is too old. Please upgrade to the 9.9 Long-Term Active version first.");
}
@Test