This commit includes the new index on REVIEWS.RESOURCE_ID and the renaming of ACTION_PLANS.DEAD_LINE to DEADLINE
mapper.deleteResourceUserRoles(resourceId);
mapper.deleteResourceManualMeasures(resourceId);
mapper.deleteResourceReviews(resourceId);
+ mapper.deleteResourceReviewComments(resourceId);
+ mapper.deleteResourceActionPlansReviews(resourceId);
+ mapper.deleteResourceActionPlans(resourceId);
mapper.deleteResourceEvents(resourceId);
mapper.deleteResource(resourceId);
}
void deleteResourceReviews(long resourceId);
+ void deleteResourceReviewComments(long resourceId);
+
void deleteResourceEvents(long resourceId);
+ void deleteResourceActionPlans(long resourceId);
+
+ void deleteResourceActionPlansReviews(long resourceId);
+
void closeResourceReviews(long resourceId);
List<PurgeableSnapshotDto> selectPurgeableSnapshotsWithEvents(long resourceId);
public final static int VERSION_UNKNOWN = -1;
- public static final int LAST_VERSION = 257;
+ public static final int LAST_VERSION = 259;
public static final int VERSION_2_13 = 241;
public final static String TABLE_NAME = "schema_migrations";
INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('255');
INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('256');
INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('257');
+INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('258');
+INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('259');
INSERT INTO USERS(ID, LOGIN, NAME, EMAIL, CRYPTED_PASSWORD, SALT, CREATED_AT, UPDATED_AT, REMEMBER_TOKEN, REMEMBER_TOKEN_EXPIRES_AT) VALUES (1, 'admin', 'Administrator', '', 'a373a0e667abb2604c1fd571eb4ad47fe8cc0878', '48bc4b0d93179b5103fd3885ea9119498e9d161b', '2011-09-26 22:27:48.0', '2011-09-26 22:27:48.0', null, null);
ALTER TABLE USERS ALTER COLUMN ID RESTART WITH 2;
"USER_ID" INTEGER,
"NAME" VARCHAR(200),
"DESCRIPTION" VARCHAR(1000),
- "DEAD_LINE" TIMESTAMP,
+ "DEADLINE" TIMESTAMP,
"USER_LOGIN" VARCHAR(40),
"PROJECT_ID" INTEGER,
"STATUS" VARCHAR(10),
CREATE INDEX "INDEX_RULE_NOTES_ON_ACTIVE_RULE_ID" ON "RULE_NOTES" ("RULE_ID");
+CREATE INDEX "REVIEWS_RID" ON "REVIEWS" ("RESOURCE_ID");
+
-- ----------------------------------------------
-- DDL Statements for keys
delete from reviews where resource_id=#{id}
</delete>
+ <delete id="deleteResourceReviewComments" parameterType="long">
+ delete from review_comments rc where exists (select * from reviews r where rc.review_id=r.id and r.resource_id=#{id})
+ </delete>
+
<delete id="deleteResourceEvents" parameterType="long">
delete from events where resource_id=#{id}
</delete>
+ <delete id="deleteResourceActionPlans" parameterType="long">
+ delete from action_plans where project_id=#{id}
+ </delete>
+
+ <delete id="deleteResourceActionPlansReviews" parameterType="long">
+ delete from action_plans_reviews apr where exists (select * from action_plans ap where ap.id=apr.action_plan_id and ap.project_id=#{id})
+ </delete>
+
<update id="setSnapshotIsLastToFalse" parameterType="long">
update snapshots set islast=${_false} where project_id=#{id}
</update>
public void shouldDeleteProject() {
setupData("shouldDeleteProject");
dao.deleteProject(1L);
- assertEmptyTables("projects", "snapshots");
+ assertEmptyTables("projects", "snapshots", "action_plans", "action_plans_reviews", "reviews", "review_comments");
}
static final class SnapshotMatcher extends BaseMatcher<PurgeableSnapshotDto> {
build_date="2008-12-02 13:58:00.00"
version="[null]" path="[null]"/>
+ <action_plans id="1" project_id="1" user_id="100" name="SHORT_TERM" description="[null]" deadline="[null]"
+ user_login="igor" status="[null]" created_at="[null]" updated_at="[null]" />
+
+ <action_plans_reviews action_plan_id="1" review_id="250" />
+
+ <reviews id="1" project_id="1" resource_id="1" status="CLOSED"
+ rule_failure_permanent_id="1" resolution="[null]" created_at="[null]" resource_line="200" severity="BLOCKER"
+ user_id="300" assignee_id="300" rule_id="500" manual_violation="[true]" manual_severity="[false]" title="[null]"/>
+
+ <reviews id="2" project_id="1" resource_id="1" status="CLOSED"
+ rule_failure_permanent_id="2" resolution="[null]" created_at="[null]" resource_line="200" severity="BLOCKER"
+ user_id="300" assignee_id="300" rule_id="500" manual_violation="[true]" manual_severity="[false]" title="[null]"/>
+
<!-- modules -->
<projects id="2" enabled="[true]" root_id="1"
t.column 'status', :string, :null => true, :limit => 10
t.column 'severity', :string, :null => true, :limit => 10
t.column 'rule_failure_permanent_id', :integer, :null => true
- t.column 'project_id', :integer, :null => true
+ t.column 'project_id', :integer, :null => true
t.column 'resource_id', :integer, :null => true
t.column 'resource_line', :integer, :null => true
end
--- /dev/null
+#
+# Sonar, entreprise quality control tool.
+# Copyright (C) 2008-2012 SonarSource
+# mailto:contact AT sonarsource DOT com
+#
+# Sonar is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 3 of the License, or (at your option) any later version.
+#
+# Sonar is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with Sonar; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02
+#
+
+#
+# Sonar 2.14
+#
+class AddIndexOnReviewResourceId < ActiveRecord::Migration
+
+ def self.up
+ begin
+ add_index('reviews', 'resource_id', :name => 'reviews_rid')
+ rescue
+ # already exists
+ end
+ end
+
+end
--- /dev/null
+#
+# Sonar, entreprise quality control tool.
+# Copyright (C) 2008-2012 SonarSource
+# mailto:contact AT sonarsource DOT com
+#
+# Sonar is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 3 of the License, or (at your option) any later version.
+#
+# Sonar is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with Sonar; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02
+#
+
+#
+# Sonar 2.14
+#
+class RenameActionPlansColumns < ActiveRecord::Migration
+
+ def self.up
+ rename_column(:action_plans, :dead_line, :deadline)
+ end
+
+end