From 45233feda278bc1e388c19bd9c454943344f6847 Mon Sep 17 00:00:00 2001 From: Zipeng WU Date: Fri, 25 Jun 2021 17:54:21 +0200 Subject: [PATCH] SONAR-10762 Drop manual measures table --- .../java/org/sonar/db/version/SqTables.java | 1 - .../java/org/sonar/db/metric/MetricDao.java | 4 -- .../org/sonar/db/metric/MetricMapper.java | 2 - .../org/sonar/db/metric/MetricMapper.xml | 11 ---- server/sonar-db-dao/src/schema/schema-sq.ddl | 14 ----- .../org/sonar/db/metric/MetricDaoTest.java | 12 ----- .../MigrationConfigurationModule.java | 2 + .../db/migration/version/v91/DbVersion91.java | 44 ++++++++++++++++ .../DropManualMeasuresComponentUuidIndex.java | 32 ++++++++++++ .../version/v91/DropManualMeasuresTable.java | 38 ++++++++++++++ .../version/v91/DbVersion91Test.java | 47 +++++++++++++++++ ...pManualMeasuresComponentUuidIndexTest.java | 51 +++++++++++++++++++ .../v91/DropManualMeasuresTableTest.java | 51 +++++++++++++++++++ .../schema.sql | 13 +++++ .../DropManualMeasuresTableTest/schema.sql | 12 +++++ 15 files changed, 290 insertions(+), 44 deletions(-) create mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v91/DbVersion91.java create mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v91/DropManualMeasuresComponentUuidIndex.java create mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v91/DropManualMeasuresTable.java create mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v91/DbVersion91Test.java create mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v91/DropManualMeasuresComponentUuidIndexTest.java create mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v91/DropManualMeasuresTableTest.java create mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v91/DropManualMeasuresComponentUuidIndexTest/schema.sql create mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v91/DropManualMeasuresTableTest/schema.sql diff --git a/server/sonar-db-core/src/main/java/org/sonar/db/version/SqTables.java b/server/sonar-db-core/src/main/java/org/sonar/db/version/SqTables.java index 16b37ae57c0..b1cc497f535 100644 --- a/server/sonar-db-core/src/main/java/org/sonar/db/version/SqTables.java +++ b/server/sonar-db-core/src/main/java/org/sonar/db/version/SqTables.java @@ -62,7 +62,6 @@ public final class SqTables { "issues", "issue_changes", "live_measures", - "manual_measures", "metrics", "new_code_periods", "notifications", diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/metric/MetricDao.java b/server/sonar-db-dao/src/main/java/org/sonar/db/metric/MetricDao.java index 82e568a729b..566c0e49393 100644 --- a/server/sonar-db-dao/src/main/java/org/sonar/db/metric/MetricDao.java +++ b/server/sonar-db-dao/src/main/java/org/sonar/db/metric/MetricDao.java @@ -102,10 +102,6 @@ public class MetricDao implements Dao { return newArrayList(Collections2.filter(mapper(session).selectDomains(), new NotEmptyPredicate())); } - public List selectAvailableCustomMetricsByComponentUuid(DbSession session, String projectUuid) { - return mapper(session).selectAvailableCustomMetricsByComponentUuid(projectUuid); - } - public List selectByUuids(DbSession session, Set uuidsSet) { return executeLargeInputs(new ArrayList<>(uuidsSet), mapper(session)::selectByUuids); } diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/metric/MetricMapper.java b/server/sonar-db-dao/src/main/java/org/sonar/db/metric/MetricMapper.java index a0c5f1bf72c..a3537c1d5b0 100644 --- a/server/sonar-db-dao/src/main/java/org/sonar/db/metric/MetricMapper.java +++ b/server/sonar-db-dao/src/main/java/org/sonar/db/metric/MetricMapper.java @@ -52,6 +52,4 @@ public interface MetricMapper { int countEnabled(@Param("isCustom") @Nullable Boolean isCustom); void update(MetricDto metric); - - List selectAvailableCustomMetricsByComponentUuid(String projectUuid); } diff --git a/server/sonar-db-dao/src/main/resources/org/sonar/db/metric/MetricMapper.xml b/server/sonar-db-dao/src/main/resources/org/sonar/db/metric/MetricMapper.xml index acd5b2ea81d..a45239d3346 100644 --- a/server/sonar-db-dao/src/main/resources/org/sonar/db/metric/MetricMapper.xml +++ b/server/sonar-db-dao/src/main/resources/org/sonar/db/metric/MetricMapper.xml @@ -56,17 +56,6 @@ ORDER BY UPPER(m.short_name), m.short_name - -