aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-core
diff options
context:
space:
mode:
authorSimon Brandhof <simon.brandhof@sonarsource.com>2014-09-15 15:57:17 +0200
committerSimon Brandhof <simon.brandhof@sonarsource.com>2014-09-15 15:57:17 +0200
commita31b72f90bc2fb0f04abf6f9646436e257204d27 (patch)
treeebe2ae50303bad5c3a3c41f508b1dfe9ffeb7168 /sonar-core
parent3512475d7d4f437403b482f43bbf4790b8736cca (diff)
parentadd64436be2fc275aa2578dc6a4eeab427b41208 (diff)
downloadsonarqube-a31b72f90bc2fb0f04abf6f9646436e257204d27.tar.gz
sonarqube-a31b72f90bc2fb0f04abf6f9646436e257204d27.zip
Merge branch 'branch-4.5'
Conflicts: server/sonar-server/src/main/java/org/sonar/server/db/migrations/DatabaseMigrations.java sonar-core/src/main/java/org/sonar/core/persistence/DatabaseVersion.java sonar-core/src/main/resources/org/sonar/core/persistence/rows-h2.sql
Diffstat (limited to 'sonar-core')
-rw-r--r--sonar-core/src/main/java/org/sonar/core/persistence/migration/v44/Migration44Mapper.java4
-rw-r--r--sonar-core/src/main/resources/org/sonar/core/persistence/migration/v44/Migration44Mapper.xml12
-rw-r--r--sonar-core/src/main/resources/org/sonar/core/persistence/rows-h2.sql1
3 files changed, 17 insertions, 0 deletions
diff --git a/sonar-core/src/main/java/org/sonar/core/persistence/migration/v44/Migration44Mapper.java b/sonar-core/src/main/java/org/sonar/core/persistence/migration/v44/Migration44Mapper.java
index 19075d6e9db..8bffe19dd17 100644
--- a/sonar-core/src/main/java/org/sonar/core/persistence/migration/v44/Migration44Mapper.java
+++ b/sonar-core/src/main/java/org/sonar/core/persistence/migration/v44/Migration44Mapper.java
@@ -40,6 +40,8 @@ public interface Migration44Mapper {
void updateProfileMeasure(@Param("measureId") long measureId, @Param("json") String json);
+ void deleteProfileMeasure(long profileMeasureId);
+
@CheckForNull
QProfileDto44 selectProfileById(int id);
@@ -56,4 +58,6 @@ public interface Migration44Mapper {
// migrate changeLog to Activities
List<ChangeLog> selectActiveRuleChange(@Nullable @Param("enabled") Boolean enabled);
+
+ List<Long> selectMeasuresOnDeletedQualityProfiles();
}
diff --git a/sonar-core/src/main/resources/org/sonar/core/persistence/migration/v44/Migration44Mapper.xml b/sonar-core/src/main/resources/org/sonar/core/persistence/migration/v44/Migration44Mapper.xml
index f2c0c203b09..eeb24110187 100644
--- a/sonar-core/src/main/resources/org/sonar/core/persistence/migration/v44/Migration44Mapper.xml
+++ b/sonar-core/src/main/resources/org/sonar/core/persistence/migration/v44/Migration44Mapper.xml
@@ -35,6 +35,18 @@
where id=#{measureId}
</update>
+ <delete id="deleteProfileMeasure" parameterType="long">
+ delete from project_measures where id=#{id}
+ </delete>
+
+ <select id="selectMeasuresOnDeletedQualityProfiles" resultType="long">
+ select pm.id from project_measures pm
+ inner join snapshots as s on s.id=pm.snapshot_id and s.islast=${_true}
+ where
+ pm.metric_id=(select id from metrics where name='quality_profiles')
+ and pm.value is not null
+ </select>
+
<select id="selectProfileUpdatedAt" resultType="date" parameterType="int">
select max(change_date) from active_rule_changes
where profile_id=#{id}
diff --git a/sonar-core/src/main/resources/org/sonar/core/persistence/rows-h2.sql b/sonar-core/src/main/resources/org/sonar/core/persistence/rows-h2.sql
index ddf06f6e80b..78c9e4ceb49 100644
--- a/sonar-core/src/main/resources/org/sonar/core/persistence/rows-h2.sql
+++ b/sonar-core/src/main/resources/org/sonar/core/persistence/rows-h2.sql
@@ -253,6 +253,7 @@ INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('580');
INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('581');
INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('582');
INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('583');
+INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('584');
INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('700');
INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('701');