aboutsummaryrefslogtreecommitdiffstats
path: root/server
diff options
context:
space:
mode:
authorEric Giffon <eric.giffon@sonarsource.com>2024-09-30 11:17:15 +0200
committersonartech <sonartech@sonarsource.com>2024-10-09 20:02:47 +0000
commitf5faab7f779124905eb84b7e8ae28db52c1dd685 (patch)
treeb3e170dbad175c4fcccc0a34d528a85ad2f08af7 /server
parent23e16bb41bac524e51bfa0fe1b6a2b1d21504992 (diff)
downloadsonarqube-f5faab7f779124905eb84b7e8ae28db52c1dd685.tar.gz
sonarqube-f5faab7f779124905eb84b7e8ae28db52c1dd685.zip
SONAR-22880 Update migration flag on sub-portfolios
Diffstat (limited to 'server')
-rw-r--r--server/sonar-db-dao/src/it/java/org/sonar/db/portfolio/PortfolioDaoIT.java3
-rw-r--r--server/sonar-db-dao/src/main/resources/org/sonar/db/portfolio/PortfolioMapper.xml2
-rw-r--r--server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v108/package-info.java23
3 files changed, 27 insertions, 1 deletions
diff --git a/server/sonar-db-dao/src/it/java/org/sonar/db/portfolio/PortfolioDaoIT.java b/server/sonar-db-dao/src/it/java/org/sonar/db/portfolio/PortfolioDaoIT.java
index eb544fde07a..07a3db425ab 100644
--- a/server/sonar-db-dao/src/it/java/org/sonar/db/portfolio/PortfolioDaoIT.java
+++ b/server/sonar-db-dao/src/it/java/org/sonar/db/portfolio/PortfolioDaoIT.java
@@ -254,12 +254,15 @@ class PortfolioDaoIT {
void update_measures_migrated() {
PortfolioDto portfolio1 = db.components().insertPrivatePortfolioDto("name1");
PortfolioDto portfolio2 = db.components().insertPrivatePortfolioDto("name2");
+ PortfolioDto portfolio3 = db.components().insertPrivatePortfolioDto("name3",
+ p -> p.setRootUuid(portfolio1.getUuid()).setParentUuid(portfolio1.getUuid()));
portfolioDao.updateMeasuresMigrated(session, portfolio1.getUuid(), true);
portfolioDao.updateMeasuresMigrated(session, portfolio2.getUuid(), false);
assertThat(getMeasuresMigrated(portfolio1.getUuid())).isTrue();
assertThat(getMeasuresMigrated(portfolio2.getUuid())).isFalse();
+ assertThat(getMeasuresMigrated(portfolio3.getUuid())).isTrue();
}
private boolean getMeasuresMigrated(String uuid1) {
diff --git a/server/sonar-db-dao/src/main/resources/org/sonar/db/portfolio/PortfolioMapper.xml b/server/sonar-db-dao/src/main/resources/org/sonar/db/portfolio/PortfolioMapper.xml
index 22f0c0ff611..c1cd7494f4c 100644
--- a/server/sonar-db-dao/src/main/resources/org/sonar/db/portfolio/PortfolioMapper.xml
+++ b/server/sonar-db-dao/src/main/resources/org/sonar/db/portfolio/PortfolioMapper.xml
@@ -567,6 +567,6 @@
measures_migrated = #{measuresMigrated, jdbcType=BOOLEAN},
updated_at = #{now, jdbcType=BIGINT}
where
- uuid = #{uuid, jdbcType=VARCHAR}
+ root_uuid = #{uuid, jdbcType=VARCHAR}
</update>
</mapper>
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v108/package-info.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v108/package-info.java
new file mode 100644
index 00000000000..06d15d95082
--- /dev/null
+++ b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v108/package-info.java
@@ -0,0 +1,23 @@
+/*
+ * SonarQube
+ * Copyright (C) 2009-2024 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+@ParametersAreNonnullByDefault
+package org.sonar.server.platform.db.migration.version.v108;
+
+import javax.annotation.ParametersAreNonnullByDefault;