From b9f8b710d6f7c3ae5799fbacb9e93403b3babf08 Mon Sep 17 00:00:00 2001 From: Simon Brandhof Date: Thu, 29 Mar 2012 19:48:01 +0200 Subject: [PATCH] Purge the table AUTHORS --- .../src/main/java/org/sonar/core/purge/PurgeCommands.java | 5 +++++ .../src/main/resources/org/sonar/core/purge/PurgeMapper.xml | 4 ++++ .../test/java/org/sonar/core/purge/PurgeCommandsTest.java | 2 +- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/sonar-core/src/main/java/org/sonar/core/purge/PurgeCommands.java b/sonar-core/src/main/java/org/sonar/core/purge/PurgeCommands.java index 22a841a2e3f..d6b26da3cbe 100644 --- a/sonar-core/src/main/java/org/sonar/core/purge/PurgeCommands.java +++ b/sonar-core/src/main/java/org/sonar/core/purge/PurgeCommands.java @@ -99,6 +99,11 @@ final class PurgeCommands { mapper.deleteResource(resourceId); } session.commit(); + + for (Long resourceId : resourceIds) { + mapper.deleteAuthors(resourceId); + } + session.commit(); } @VisibleForTesting 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 1a58d70d02d..b7abc56a6a0 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 @@ -176,6 +176,10 @@ delete from action_plans where project_id=#{id} + + delete from authors where person_id=#{id} + + update snapshots set islast=${_false} where project_id=#{id} diff --git a/sonar-core/src/test/java/org/sonar/core/purge/PurgeCommandsTest.java b/sonar-core/src/test/java/org/sonar/core/purge/PurgeCommandsTest.java index d4411bfa8be..4ffe7272474 100644 --- a/sonar-core/src/test/java/org/sonar/core/purge/PurgeCommandsTest.java +++ b/sonar-core/src/test/java/org/sonar/core/purge/PurgeCommandsTest.java @@ -83,7 +83,7 @@ public class PurgeCommandsTest extends DaoTestCase { } finally { MyBatis.closeQuietly(session); } - assertEmptyTables("projects", "snapshots", "events", "reviews", "review_comments"); + assertEmptyTables("projects", "snapshots", "events", "reviews", "review_comments", "authors"); } } -- 2.39.5