You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

PurgeMapper.xml 20KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "mybatis-3-mapper.dtd">
  3. <mapper namespace="org.sonar.db.purge.PurgeMapper">
  4. <select id="selectAnalysisUuids" parameterType="map" resultType="String">
  5. select
  6. s.uuid as uuid
  7. from
  8. snapshots s
  9. where
  10. s.root_component_uuid=#{componentUuid,jdbcType=VARCHAR}
  11. <if test="islast != null">
  12. and s.islast=#{islast}
  13. </if>
  14. <if test="notPurged != null and notPurged">
  15. and s.purged = ${_false}
  16. </if>
  17. <if test="status != null">
  18. and s.status in
  19. <foreach item="s" index="index" collection="status" open="(" separator="," close=")">#{s}</foreach>
  20. </if>
  21. </select>
  22. <select id="selectPurgeableAnalyses" parameterType="String" resultType="PurgeableAnalysis">
  23. select
  24. s.uuid as "analysisUuid",
  25. s.created_at as "date",
  26. case when ve.analysis_uuid is not null then ${_true} else ${_false} end as "hasEvents",
  27. islast as "isLast",
  28. case when ve.category='Version' then ve.name else null end as "version"
  29. from snapshots s
  30. left outer join events ve on ve.analysis_uuid=s.uuid
  31. where
  32. s.root_component_uuid=#{componentUuid,jdbcType=VARCHAR}
  33. and s.status='P'
  34. </select>
  35. <select id="selectSpecificAnalysisNewCodePeriod" parameterType="String" resultType="String">
  36. select
  37. value
  38. from
  39. new_code_periods ncp
  40. where
  41. ncp.type='SPECIFIC_ANALYSIS'
  42. AND ncp.branch_uuid=#{projectUuid,jdbcType=VARCHAR}
  43. </select>
  44. <select id="selectStaleBranchesAndPullRequests" parameterType="map" resultType="String">
  45. select
  46. pb.uuid
  47. from
  48. project_branches pb
  49. left join snapshots s
  50. on
  51. s.root_component_uuid = pb.uuid
  52. and s.islast=${_true}
  53. where
  54. pb.project_uuid=#{projectUuid,jdbcType=VARCHAR}
  55. and (pb.branch_type = 'PULL_REQUEST' or pb.exclude_from_purge = ${_false})
  56. and (s.created_at is null or s.created_at &lt; #{toDate})
  57. and (pb.created_at &lt; #{toDate})
  58. </select>
  59. <select id="selectRootAndSubviewsByProjectUuid" resultType="String" parameterType="String">
  60. select
  61. p.uuid
  62. from
  63. components p
  64. where
  65. (
  66. p.branch_uuid=#{rootUuid,jdbcType=VARCHAR}
  67. and p.scope = 'PRJ' and p.qualifier = 'SVW'
  68. )
  69. or (
  70. uuid=#{rootUuid,jdbcType=VARCHAR}
  71. and p.scope = 'PRJ' and p.qualifier in ('APP', 'VW','TRK')
  72. )
  73. </select>
  74. <select id="selectDisabledComponentsWithFileSource" parameterType="map" resultType="String">
  75. select
  76. file_uuid
  77. from file_sources fs
  78. inner join components p on
  79. p.uuid = fs.file_uuid
  80. and p.enabled = ${_false}
  81. and p.branch_uuid=#{branchUuid,jdbcType=VARCHAR}
  82. </select>
  83. <select id="selectDisabledComponentsWithUnresolvedIssues" parameterType="map" resultType="String">
  84. select
  85. i.component_uuid
  86. from issues i
  87. inner join components p on
  88. p.uuid = i.component_uuid
  89. and p.enabled = ${_false}
  90. and p.branch_uuid=#{branchUuid,jdbcType=VARCHAR}
  91. where
  92. resolution is null
  93. </select>
  94. <select id="selectDisabledComponentsWithLiveMeasures" parameterType="map" resultType="String">
  95. select
  96. lm.component_uuid
  97. from live_measures lm
  98. inner join components p on
  99. p.uuid = lm.component_uuid
  100. and p.enabled = ${_false}
  101. and p.branch_uuid=#{branchUuid,jdbcType=VARCHAR}
  102. </select>
  103. <delete id="deleteAnalysisMeasures" parameterType="map">
  104. delete from project_measures
  105. where
  106. analysis_uuid in
  107. <foreach collection="analysisUuids" open="(" close=")" item="analysisUuid" separator=",">
  108. #{analysisUuid,jdbcType=VARCHAR}
  109. </foreach>
  110. </delete>
  111. <delete id="fullDeleteComponentMeasures" parameterType="map">
  112. delete from project_measures
  113. where
  114. component_uuid in
  115. <foreach collection="componentUuids" open="(" close=")" item="componentUuid" separator=",">
  116. #{componentUuid,jdbcType=VARCHAR}
  117. </foreach>
  118. </delete>
  119. <delete id="deleteAnalysisDuplications" parameterType="map">
  120. delete from duplications_index
  121. where
  122. analysis_uuid in
  123. <foreach collection="analysisUuids" open="(" close=")" item="analysisUuid" separator=",">
  124. #{analysisUuid,jdbcType=VARCHAR}
  125. </foreach>
  126. </delete>
  127. <delete id="deleteAnalysisEvents" parameterType="map">
  128. delete from events
  129. where
  130. analysis_uuid in
  131. <foreach collection="analysisUuids" open="(" close=")" item="analysisUuid" separator=",">
  132. #{analysisUuid,jdbcType=VARCHAR}
  133. </foreach>
  134. </delete>
  135. <delete id="deleteAnalysisEventComponentChanges" parameterType="map">
  136. delete from event_component_changes
  137. where
  138. event_analysis_uuid in
  139. <foreach collection="analysisUuids" open="(" close=")" item="analysisUuid" separator=",">
  140. #{analysisUuid,jdbcType=VARCHAR}
  141. </foreach>
  142. </delete>
  143. <delete id="deleteAnalyses" parameterType="map">
  144. delete from snapshots
  145. where
  146. uuid in
  147. <foreach collection="analysisUuids" open="(" close=")" item="analysisUuid" separator=",">
  148. #{analysisUuid,jdbcType=VARCHAR}
  149. </foreach>
  150. </delete>
  151. <delete id="deleteAnalysisProperties" parameterType="map">
  152. DELETE FROM analysis_properties
  153. WHERE
  154. analysis_uuid IN
  155. <foreach collection="analysisUuids" open="(" close=")" item="analysisUuid" separator=",">
  156. #{analysisUuid,jdbcType=VARCHAR}
  157. </foreach>
  158. </delete>
  159. <update id="updatePurgeStatusToOne" parameterType="map">
  160. update
  161. snapshots
  162. set
  163. purged = ${_true}
  164. where
  165. uuid in
  166. <foreach collection="analysisUuids" open="(" close=")" item="analysisUuid" separator=",">
  167. #{analysisUuid,jdbcType=VARCHAR}
  168. </foreach>
  169. </update>
  170. <update id="resolveComponentIssuesNotAlreadyResolved" parameterType="map">
  171. update
  172. issues
  173. set
  174. status='CLOSED',
  175. resolution='REMOVED',
  176. updated_at=#{dateAsLong},
  177. issue_close_date=#{dateAsLong},
  178. issue_update_date=#{dateAsLong}
  179. where
  180. component_uuid in
  181. <foreach collection="componentUuids" open="(" close=")" item="componentUuid" separator=",">
  182. #{componentUuid,jdbcType=VARCHAR}
  183. </foreach>
  184. and resolution is null
  185. </update>
  186. <delete id="deleteProjectLinksByProjectUuid" parameterType="map">
  187. delete from project_links
  188. where
  189. project_uuid = #{rootUuid,jdbcType=VARCHAR}
  190. </delete>
  191. <delete id="deletePropertiesByEntityUuids" parameterType="map">
  192. delete from properties
  193. where
  194. entity_uuid in
  195. <foreach collection="entityUuids" open="(" close=")" item="entityUuid" separator=",">
  196. #{entityUuid}
  197. </foreach>
  198. </delete>
  199. <delete id="deleteComponentsByBranchUuid" parameterType="map">
  200. delete from components
  201. where
  202. branch_uuid = #{rootUuid,jdbcType=VARCHAR}
  203. </delete>
  204. <delete id="deleteNonMainBranchComponentsByProjectUuid" parameterType="map">
  205. delete from components
  206. where
  207. branch_uuid IN (SELECT pb.uuid from project_branches pb
  208. where
  209. pb.is_main = ${_false} and pb.project_uuid = #{uuid,jdbcType=VARCHAR})
  210. </delete>
  211. <delete id="deleteProjectsByProjectUuid" parameterType="map">
  212. delete from projects
  213. where
  214. uuid = #{projectUuid,jdbcType=VARCHAR}
  215. </delete>
  216. <delete id="deleteComponentsByUuids" parameterType="map">
  217. delete from components
  218. where
  219. uuid in
  220. <foreach collection="componentUuids" open="(" close=")" item="componentUuid" separator=",">
  221. #{componentUuid,jdbcType=VARCHAR}
  222. </foreach>
  223. </delete>
  224. <delete id="deleteGroupRolesByEntityUuid" parameterType="map">
  225. delete from group_roles
  226. where
  227. entity_uuid = #{entityUuid,jdbcType=INTEGER}
  228. </delete>
  229. <delete id="deleteUserRolesByEntityUuid" parameterType="map">
  230. delete from user_roles
  231. where
  232. entity_uuid = #{entityUuid,jdbcType=INTEGER}
  233. </delete>
  234. <delete id="deleteEventsByComponentUuid" parameterType="map">
  235. delete from events
  236. where
  237. component_uuid = #{componentUuid,jdbcType=VARCHAR}
  238. </delete>
  239. <delete id="deleteEventComponentChangesByComponentUuid" parameterType="map">
  240. delete from event_component_changes
  241. where
  242. event_component_uuid = #{componentUuid,jdbcType=VARCHAR}
  243. </delete>
  244. <delete id="deleteIssuesByProjectUuid" parameterType="map">
  245. delete from issues
  246. where project_uuid = #{projectUuid,jdbcType=VARCHAR}
  247. </delete>
  248. <delete id="deleteIssueChangesByProjectUuid" parameterType="map">
  249. delete from issue_changes where project_uuid = #{projectUuid,jdbcType=VARCHAR}
  250. </delete>
  251. <delete id="deleteNewCodeReferenceIssuesByProjectUuid" parameterType="map">
  252. delete from new_code_reference_issues
  253. where
  254. issue_key in (
  255. select
  256. kee
  257. from issues
  258. where
  259. project_uuid = #{projectUuid,jdbcType=VARCHAR}
  260. )
  261. </delete>
  262. <delete id="deleteIssuesImpactsByProjectUuid" parameterType="map">
  263. delete from issues_impacts
  264. where
  265. issue_key in (
  266. select
  267. kee
  268. from issues
  269. where
  270. project_uuid = #{projectUuid,jdbcType=VARCHAR}
  271. )
  272. </delete>
  273. <delete id="deleteFileSourcesByProjectUuid">
  274. delete from file_sources where project_uuid=#{rootProjectUuid,jdbcType=VARCHAR}
  275. </delete>
  276. <delete id="deleteFileSourcesByFileUuid">
  277. delete from file_sources
  278. where
  279. file_uuid in
  280. <foreach collection="fileUuids" open="(" close=")" item="fileUuid" separator=",">
  281. #{fileUuid,jdbcType=VARCHAR}
  282. </foreach>
  283. </delete>
  284. <select id="selectOldClosedIssueKeys" parameterType="map" resultType="String">
  285. SELECT kee FROM issues
  286. WHERE project_uuid=#{projectUuid,jdbcType=VARCHAR}
  287. <choose>
  288. <when test="toDate == null">
  289. AND issue_close_date IS NOT NULL
  290. </when>
  291. <otherwise>
  292. AND issue_close_date &lt; #{toDate}
  293. </otherwise>
  294. </choose>
  295. </select>
  296. <select id="selectBranchOrphanIssues" parameterType="map">
  297. select i.kee from issues i
  298. left outer join components c on i.component_uuid = c.uuid
  299. where i.project_uuid = #{branchUuid,jdbcType=VARCHAR} and c.kee is null
  300. </select>
  301. <select id="selectDisabledComponentsWithoutIssues" resultType="String" parameterType="String">
  302. SELECT
  303. p.uuid
  304. FROM
  305. components p
  306. WHERE
  307. p.enabled = ${_false}
  308. AND p.branch_uuid=#{branchUuid,jdbcType=VARCHAR}
  309. AND NOT EXISTS (SELECT 1 FROM issues i WHERE i.component_uuid = p.uuid)
  310. </select>
  311. <delete id="deleteIssuesFromKeys" parameterType="map">
  312. DELETE FROM issues
  313. WHERE kee IN
  314. <foreach collection="keys" open="(" close=")" item="key" separator=",">
  315. #{key,jdbcType=VARCHAR}
  316. </foreach>
  317. </delete>
  318. <delete id="deleteAppProjectsByAppUuid" parameterType="map">
  319. DELETE
  320. FROM app_projects
  321. WHERE
  322. application_uuid=#{applicationUuid,jdbcType=VARCHAR}
  323. </delete>
  324. <delete id="deleteAppProjectsByProjectUuid" parameterType="map">
  325. DELETE
  326. FROM app_projects
  327. WHERE
  328. project_uuid=#{projectUuid,jdbcType=VARCHAR}
  329. </delete>
  330. <delete id="deleteAppBranchProjectBranchesByAppUuid" parameterType="map">
  331. DELETE
  332. FROM app_branch_project_branch
  333. WHERE
  334. application_uuid=#{applicationUuid,jdbcType=VARCHAR}
  335. </delete>
  336. <delete id="deleteAppBranchProjectBranchesByProjectUuid" parameterType="map">
  337. DELETE
  338. FROM app_branch_project_branch
  339. WHERE
  340. project_uuid=#{projectUuid,jdbcType=VARCHAR}
  341. </delete>
  342. <delete id="deleteAppBranchProjectsByAppBranchUuid" parameterType="String">
  343. DELETE
  344. FROM app_branch_project_branch
  345. WHERE
  346. application_branch_uuid=#{branchUuid,jdbcType=VARCHAR}
  347. </delete>
  348. <delete id="deleteAppBranchProjectBranchesByProjectBranchUuid" parameterType="String">
  349. DELETE
  350. FROM app_branch_project_branch
  351. WHERE project_branch_uuid=#{projectBranchUuid,jdbcType=VARCHAR}
  352. </delete>
  353. <delete id="deletePortfolioProjectsByBranchUuid" parameterType="map">
  354. <!-- deletes selected projects that were only selecting the branch being deleted -->
  355. DELETE
  356. FROM portfolio_projects
  357. WHERE uuid in (
  358. SELECT ppb.portfolio_project_uuid FROM portfolio_proj_branches ppb
  359. <!-- branch was selected -->
  360. WHERE ppb.branch_uuid = #{branchUuid,jdbcType=VARCHAR}
  361. <!-- and was the only one selected in the project -->
  362. AND (SELECT count(*) FROM portfolio_proj_branches ppb2 WHERE ppb2.portfolio_project_uuid = ppb.portfolio_project_uuid) = 1
  363. )
  364. </delete>
  365. <delete id="deletePortfolioProjectsByProjectUuid" parameterType="map">
  366. DELETE
  367. FROM portfolio_projects
  368. WHERE project_uuid=#{projectUuid,jdbcType=VARCHAR}
  369. </delete>
  370. <delete id="deletePortfolioProjectBranchesByBranchUuid" parameterType="map">
  371. DELETE FROM portfolio_proj_branches
  372. WHERE portfolio_project_uuid IN (SELECT uuid FROM portfolio_projects WHERE project_uuid = #{branchUuid,jdbcType=VARCHAR})
  373. OR branch_uuid = #{branchUuid,jdbcType=VARCHAR}
  374. </delete>
  375. <delete id="deleteIssueChangesFromIssueKeys" parameterType="map">
  376. DELETE FROM issue_changes
  377. WHERE issue_key IN
  378. <foreach collection="issueKeys" open="(" close=")" item="issueKey" separator=",">
  379. #{issueKey,jdbcType=VARCHAR}
  380. </foreach>
  381. </delete>
  382. <delete id="deleteNewCodeReferenceIssuesFromKeys" parameterType="map">
  383. DELETE FROM new_code_reference_issues
  384. WHERE issue_key IN
  385. <foreach collection="issueKeys" open="(" close=")" item="issueKey" separator=",">
  386. #{issueKey,jdbcType=VARCHAR}
  387. </foreach>
  388. </delete>
  389. <delete id="deleteIssuesImpactsFromKeys" parameterType="map">
  390. DELETE FROM issues_impacts
  391. WHERE issue_key IN
  392. <foreach collection="issueKeys" open="(" close=")" item="issueKey" separator=",">
  393. #{issueKey,jdbcType=VARCHAR}
  394. </foreach>
  395. </delete>
  396. <delete id="deleteCeScannerContextOfCeActivityByRootUuidOrBefore">
  397. delete from ce_scanner_context
  398. where
  399. task_uuid in (
  400. select
  401. uuid
  402. from ce_activity
  403. <include refid="whereClauseCeActivityByRootUuidOrBefore"/>
  404. )
  405. </delete>
  406. <delete id="deleteCeTaskCharacteristicsOfCeActivityByRootUuidOrBefore">
  407. delete from ce_task_characteristics
  408. where
  409. task_uuid in (
  410. select
  411. uuid
  412. from ce_activity
  413. <include refid="whereClauseCeActivityByRootUuidOrBefore"/>
  414. )
  415. </delete>
  416. <delete id="deleteCeTaskInputOfCeActivityByRootUuidOrBefore">
  417. delete from ce_task_input
  418. where
  419. task_uuid in (
  420. select
  421. uuid
  422. from ce_activity
  423. <include refid="whereClauseCeActivityByRootUuidOrBefore"/>
  424. )
  425. </delete>
  426. <delete id="deleteCeTaskMessageOfCeActivityByRootUuidOrBefore">
  427. delete from ce_task_message
  428. where
  429. task_uuid in (
  430. select
  431. uuid
  432. from ce_activity
  433. <include refid="whereClauseCeActivityByRootUuidOrBefore"/>
  434. )
  435. </delete>
  436. <delete id="deleteCeActivityByRootUuidOrBefore">
  437. delete from ce_activity
  438. <include refid="whereClauseCeActivityByRootUuidOrBefore"/>
  439. </delete>
  440. <sql id="whereClauseCeActivityByRootUuidOrBefore">
  441. where
  442. <choose>
  443. <when test="rootUuid != null and createdAtBefore != null">
  444. created_at &lt; #{createdAtBefore,jdbcType=BIGINT}
  445. and (
  446. component_uuid=#{rootUuid,jdbcType=VARCHAR}
  447. <if test="entityUuidToPurge != null">
  448. or entity_uuid=#{entityUuidToPurge,jdbcType=VARCHAR}
  449. </if>
  450. )
  451. </when>
  452. <when test="createdAtBefore != null">
  453. created_at &lt; #{createdAtBefore,jdbcType=BIGINT}
  454. </when>
  455. <when test="rootUuid != null">
  456. component_uuid=#{rootUuid,jdbcType=VARCHAR}
  457. <if test="entityUuidToPurge != null">
  458. or entity_uuid=#{entityUuidToPurge,jdbcType=VARCHAR}
  459. </if>
  460. </when>
  461. <!-- safety net when both variables are null to never generate a
  462. delete statement deleting the whole table -->
  463. <otherwise>
  464. 1 = 2
  465. </otherwise>
  466. </choose>
  467. </sql>
  468. <delete id="deleteCeScannerContextOfCeQueueByRootUuid">
  469. delete from ce_scanner_context
  470. where
  471. task_uuid in (
  472. select
  473. uuid
  474. from ce_queue
  475. where
  476. component_uuid=#{rootUuid,jdbcType=VARCHAR}
  477. or entity_uuid=#{rootUuid,jdbcType=VARCHAR}
  478. )
  479. </delete>
  480. <delete id="deleteCeTaskCharacteristicsOfCeQueueByRootUuid">
  481. delete from ce_task_characteristics
  482. where
  483. task_uuid in (
  484. select
  485. uuid
  486. from ce_queue
  487. where
  488. component_uuid=#{rootUuid,jdbcType=VARCHAR}
  489. or entity_uuid=#{rootUuid,jdbcType=VARCHAR}
  490. )
  491. </delete>
  492. <delete id="deleteCeTaskInputOfCeQueueByRootUuid">
  493. delete from ce_task_input
  494. where
  495. task_uuid in (
  496. select
  497. uuid
  498. from ce_queue
  499. where
  500. component_uuid=#{rootUuid,jdbcType=VARCHAR}
  501. or entity_uuid=#{rootUuid,jdbcType=VARCHAR}
  502. )
  503. </delete>
  504. <delete id="deleteCeTaskMessageOfCeQueueByRootUuid">
  505. delete from ce_task_message
  506. where
  507. task_uuid in (
  508. select
  509. uuid
  510. from ce_queue
  511. where
  512. component_uuid=#{rootUuid,jdbcType=VARCHAR}
  513. or entity_uuid=#{rootUuid,jdbcType=VARCHAR}
  514. )
  515. </delete>
  516. <delete id="deleteCeQueueByRootUuid">
  517. delete from ce_queue
  518. where
  519. component_uuid=#{rootUuid,jdbcType=VARCHAR}
  520. or entity_uuid=#{rootUuid,jdbcType=VARCHAR}
  521. </delete>
  522. <delete id="deleteNewCodePeriodsByProjectUuid">
  523. DELETE FROM new_code_periods
  524. WHERE
  525. project_uuid=#{projectUuid,jdbcType=VARCHAR}
  526. </delete>
  527. <delete id="deleteNewCodePeriodsByBranchUuid">
  528. DELETE FROM new_code_periods
  529. WHERE
  530. branch_uuid=#{branchUuid,jdbcType=VARCHAR}
  531. </delete>
  532. <delete id="deleteWebhooksByProjectUuid">
  533. delete from webhooks where project_uuid=#{projectUuid,jdbcType=VARCHAR}
  534. </delete>
  535. <delete id="deleteWebhookDeliveriesByProjectUuid">
  536. delete from webhook_deliveries where project_uuid=#{projectUuid,jdbcType=VARCHAR}
  537. </delete>
  538. <delete id="deleteProjectAlmSettingsByProjectUuid">
  539. delete from project_alm_settings where project_uuid=#{projectUuid,jdbcType=VARCHAR}
  540. </delete>
  541. <delete id="deleteProjectBadgeTokenByProjectUuid">
  542. delete from project_badge_token where project_uuid=#{projectUuid,jdbcType=VARCHAR}
  543. </delete>
  544. <delete id="deleteBranchByUuid">
  545. delete from project_branches where uuid=#{uuid,jdbcType=VARCHAR}
  546. </delete>
  547. <delete id="deleteLiveMeasuresByProjectUuid">
  548. delete from live_measures where project_uuid = #{projectUuid,jdbcType=VARCHAR}
  549. </delete>
  550. <delete id="deleteLiveMeasuresByComponentUuids">
  551. delete from live_measures where component_uuid in <foreach item="componentUuid" index="index" collection="componentUuids" open="("
  552. separator="," close=")">#{componentUuid, jdbcType=VARCHAR}</foreach>
  553. </delete>
  554. <delete id="deleteUserDismissedMessagesByProjectUuid">
  555. delete from user_dismissed_messages where project_uuid = #{projectUuid,jdbcType=VARCHAR}
  556. </delete>
  557. <delete id="deleteScannerAnalysisCacheByBranchUuid">
  558. delete from scanner_analysis_cache where branch_uuid = #{branchUuid,jdbcType=VARCHAR}
  559. </delete>
  560. <delete id="deleteReportSchedulesByBranchUuid">
  561. delete from report_schedules where branch_uuid = #{branchUuid,jdbcType=VARCHAR}
  562. </delete>
  563. <delete id="deleteReportSubscriptionsByBranchUuid">
  564. delete from report_subscriptions where branch_uuid = #{branchUuid,jdbcType=VARCHAR}
  565. </delete>
  566. <delete id="deleteReportSchedulesByPortfolioUuids">
  567. delete from report_schedules where portfolio_uuid in <foreach item="portfolioUuid" index="index" collection="portfolioUuids" open="("
  568. separator="," close=")">#{portfolioUuid, jdbcType=VARCHAR}</foreach>
  569. </delete>
  570. <delete id="deleteReportSubscriptionsByPortfolioUuids">
  571. delete from report_subscriptions where portfolio_uuid in <foreach item="portfolioUuid" index="index" collection="portfolioUuids"
  572. open="("
  573. separator="," close=")">#{portfolioUuid, jdbcType=VARCHAR}</foreach>
  574. </delete>
  575. <delete id="deleteAnticipatedTransitionsByProjectUuidAndCreationDate">
  576. delete from anticipated_transitions where project_uuid = #{projectUuid,jdbcType=VARCHAR} and created_at &lt; #{createdAtBefore,jdbcType=BIGINT}
  577. </delete>
  578. </mapper>