aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-db-migration
diff options
context:
space:
mode:
authorlukasz-jarocki-sonarsource <lukasz.jarocki@sonarsource.com>2024-04-29 12:22:39 +0200
committersonartech <sonartech@sonarsource.com>2024-05-08 20:02:44 +0000
commit80942bfb9760881f2c26969c885d370fd4abd92e (patch)
tree52e0c3fe5bda97022a3f44bf68ece25a31053535 /server/sonar-db-migration
parent56983ba3969f653d3939484ce843a3ce928840a9 (diff)
downloadsonarqube-80942bfb9760881f2c26969c885d370fd4abd92e.tar.gz
sonarqube-80942bfb9760881f2c26969c885d370fd4abd92e.zip
SONAR-22141 added new endpoint /api/v2/system/migrations-status
Diffstat (limited to 'server/sonar-db-migration')
-rw-r--r--server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/DatabaseMigrationState.java28
1 files changed, 27 insertions, 1 deletions
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/DatabaseMigrationState.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/DatabaseMigrationState.java
index 2ee65bc6623..82bb1204e1c 100644
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/DatabaseMigrationState.java
+++ b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/DatabaseMigrationState.java
@@ -24,8 +24,34 @@ import javax.annotation.CheckForNull;
public interface DatabaseMigrationState {
+ String UNSUPPORTED_DATABASE_MIGRATION_STATUS = "Unsupported DatabaseMigration status";
+ String NO_CONNECTION_TO_DB = "Cannot connect to Database.";
+
enum Status {
- NONE, RUNNING, FAILED, SUCCEEDED
+ NONE("NO_MIGRATION", "Database is up-to-date, no migration needed."),
+ RUNNING("MIGRATION_RUNNING", "Database migration is running."),
+ FAILED("MIGRATION_FAILED", "Migration failed: %s.<br/> Please check logs."),
+ SUCCEEDED("MIGRATION_SUCCEEDED", "Migration succeeded."),
+ STATUS_NOT_SUPPORTED("NOT_SUPPORTED", "Upgrade is not supported on embedded database."),
+ MIGRATION_REQUIRED("MIGRATION_REQUIRED", "Database migration is required. DB migration can be started using WS /api/system/migrate_db.");
+
+ private final String stringRepresentation;
+ private final String message;
+
+ Status(String stringRepresentation, String message) {
+ this.stringRepresentation = stringRepresentation;
+ this.message = message;
+ }
+
+ public String getMessage() {
+ return message;
+ }
+
+ @Override
+ public String toString() {
+ return stringRepresentation;
+ }
+
}
/**