diff options
Diffstat (limited to 'server/sonar-db-dao/src/main/resources')
-rw-r--r-- | server/sonar-db-dao/src/main/resources/org/sonar/db/purge/PurgeMapper.xml | 23 |
1 files changed, 8 insertions, 15 deletions
diff --git a/server/sonar-db-dao/src/main/resources/org/sonar/db/purge/PurgeMapper.xml b/server/sonar-db-dao/src/main/resources/org/sonar/db/purge/PurgeMapper.xml index 38b34f43afe..1151abc69e5 100644 --- a/server/sonar-db-dao/src/main/resources/org/sonar/db/purge/PurgeMapper.xml +++ b/server/sonar-db-dao/src/main/resources/org/sonar/db/purge/PurgeMapper.xml @@ -22,26 +22,19 @@ </if> </select> - <select id="selectPurgeableAnalysesWithEvents" parameterType="String" resultType="PurgeableAnalysis"> + <select id="selectPurgeableAnalyses" parameterType="String" resultType="PurgeableAnalysis"> select - s.id as "analysisId", s.uuid as "analysisUuid", s.created_at as "date", ${_true} as "hasEvents", islast as "isLast", ve.name as "version" + s.id as "analysisId", + s.uuid as "analysisUuid", + s.created_at as "date", + case when ve.analysis_uuid is not null then ${_true} else ${_false} end as "hasEvents", + islast as "isLast", + case when ve.category='Version' then ve.name else null end as "version" from snapshots s - left outer join events ve on ve.analysis_uuid=s.uuid and ve.category='Version' - left outer join new_code_periods npc on ve.analysis_uuid=s.uuid and ve.category='Version' + left outer join events ve on ve.analysis_uuid=s.uuid where s.component_uuid=#{componentUuid,jdbcType=VARCHAR} and s.status='P' - and exists(select e.id from events e where e.analysis_uuid=s.uuid) - </select> - - <select id="selectPurgeableAnalysesWithoutEvents" parameterType="String" resultType="PurgeableAnalysis"> - select - s.id as "analysisId", s.uuid as "analysisUuid", s.created_at as "date", ${_false} as "hasEvents", islast as "isLast", NULL as "version" - from snapshots s - where - s.component_uuid=#{componentUuid,jdbcType=VARCHAR} - and s.status='P' - and not exists(select e.id from events e where e.analysis_uuid=s.uuid) </select> <select id="selectSpecificAnalysisNewCodePeriod" parameterType="String" resultType="String"> |