aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-core/src/main/resources
diff options
context:
space:
mode:
authorSimon Brandhof <simon.brandhof@gmail.com>2013-05-24 16:21:14 +0200
committerSimon Brandhof <simon.brandhof@gmail.com>2013-05-24 16:21:27 +0200
commit565791c16e84b8774bbf72104b7e66e0d372c5b1 (patch)
treebff3c928c2a3e0942ec020af31a279ea2f180669 /sonar-core/src/main/resources
parentcffdf6db0f8e01c3fc93afd0cb6e65b00ee10951 (diff)
downloadsonarqube-565791c16e84b8774bbf72104b7e66e0d372c5b1.tar.gz
sonarqube-565791c16e84b8774bbf72104b7e66e0d372c5b1.zip
SONAR-4308 Update the DBCleaner mechanism to purge closed issues after X weeks
Diffstat (limited to 'sonar-core/src/main/resources')
-rw-r--r--sonar-core/src/main/resources/org/sonar/core/purge/PurgeMapper.xml61
1 files changed, 61 insertions, 0 deletions
diff --git a/sonar-core/src/main/resources/org/sonar/core/purge/PurgeMapper.xml b/sonar-core/src/main/resources/org/sonar/core/purge/PurgeMapper.xml
index ab1e532a38f..1a38dae3827 100644
--- a/sonar-core/src/main/resources/org/sonar/core/purge/PurgeMapper.xml
+++ b/sonar-core/src/main/resources/org/sonar/core/purge/PurgeMapper.xml
@@ -215,5 +215,66 @@
delete from issues where resource_id=#{id}
</delete>
+
+ <delete id="deleteOldClosedIssueChanges" parameterType="map">
+ delete from issue_changes ic
+ where exists (
+ select * from issues i
+ where i.project_id=#{rootProjectId} and i.kee=ic.issue_key
+ <choose>
+ <when test="toDate == null">
+ and i.issue_close_date is not null
+ </when>
+ <otherwise>
+ and i.issue_close_date &lt; #{toDate}
+ </otherwise>
+ </choose>
+ )
+ </delete>
+
+ <!-- Mssql -->
+ <delete id="deleteOldClosedIssueChanges" databaseId="mssql" parameterType="map">
+ delete issue_changes from issue_changes
+ inner join issues on issue_changes.issue_key=issues.kee
+ where issues.project_id=#{rootProjectId}
+ <choose>
+ <when test="toDate == null">
+ and issues.issue_close_date is not null
+ </when>
+ <otherwise>
+ and issues.issue_close_date &lt; #{toDate}
+ </otherwise>
+ </choose>
+ </delete>
+
+ <!-- Mysql -->
+ <delete id="deleteOldClosedIssueChanges" databaseId="mysql" parameterType="map">
+ delete ic
+ from issue_changes as ic, issues as i
+ where i.project_id=#{rootProjectId}
+ and ic.issue_key=i.kee
+ <choose>
+ <when test="toDate == null">
+ and i.issue_close_date is not null
+ </when>
+ <otherwise>
+ and i.issue_close_date &lt; #{toDate}
+ </otherwise>
+ </choose>
+ </delete>
+
+ <delete id="deleteOldClosedIssues" parameterType="map">
+ delete from issues
+ where project_id=#{rootProjectId}
+ <choose>
+ <when test="toDate == null">
+ and issue_close_date is not null
+ </when>
+ <otherwise>
+ and issue_close_date &lt; #{toDate}
+ </otherwise>
+ </choose>
+ </delete>
+
</mapper>