aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-testing-harness/src/main
diff options
context:
space:
mode:
authorEvgeny Mandrikov <mandrikov@gmail.com>2011-05-27 02:07:33 +0400
committerEvgeny Mandrikov <mandrikov@gmail.com>2011-05-27 02:54:10 +0400
commit2dbed652688d87b303f7821ea619ed36ba654a19 (patch)
treecbf627ca9957741a70eb4dc55ca6210974986b32 /sonar-testing-harness/src/main
parent880d215a9fbafec25f7d6172b22e8dd0915a0c9a (diff)
downloadsonarqube-2dbed652688d87b303f7821ea619ed36ba654a19.tar.gz
sonarqube-2dbed652688d87b303f7821ea619ed36ba654a19.zip
SONAR-1922 Add a kind of version control for quality profiles
Apply patch, which was contributed by Julien Henry: * Following algorithm was implemented: Every profile starts with version=1 and used=false. As soon as there is an analysis of a project, the involved profile is set to used=true. Every modification to a quality profile (activation, deactivation or modification of rule) is logged in DB in dedicated tables. When a modification is done on a profile that is used=true, then version number is increased and profile is set to used=false. * Introduced new metric to store profile version, which was used during analysis. * If profile for project is different than the one used during previous analysis, then event would be created. * Introduced new tab 'changelog' for profiles. Following fixes were applied on original patch: * Index name limited to 30 characters in Oracle DB, so names were reduced. * Field ActiveRuleChange.profileVersion never read locally, because ruby read it directly from DB, so getter added. * Direction doesn't make sense for 'profile_version' metric, so was removed. * Fixed ProfileEventsSensor: it seems that TimeMachine not guarantee that the order of measures would be the same as in query, so we should perform two sequential queries. * Fixed handling of null values during migration.
Diffstat (limited to 'sonar-testing-harness/src/main')
-rw-r--r--sonar-testing-harness/src/main/resources/org/sonar/test/persistence/sonar-test.ddl26
1 files changed, 26 insertions, 0 deletions
diff --git a/sonar-testing-harness/src/main/resources/org/sonar/test/persistence/sonar-test.ddl b/sonar-testing-harness/src/main/resources/org/sonar/test/persistence/sonar-test.ddl
index 2391427880f..e8d80293808 100644
--- a/sonar-testing-harness/src/main/resources/org/sonar/test/persistence/sonar-test.ddl
+++ b/sonar-testing-harness/src/main/resources/org/sonar/test/persistence/sonar-test.ddl
@@ -25,6 +25,20 @@ create table ACTIVE_RULES (
primary key (id)
);
+create table ACTIVE_RULE_CHANGES (
+ ID INTEGER not null,
+ USER_LOGIN VARCHAR(40) not null,
+ PROFILE_ID INTEGER not null,
+ PROFILE_VERSION INTEGER not null,
+ RULE_ID INTEGER not null,
+ CHANGE_DATE TIMESTAMP not null,
+ ENABLED SMALLINT,
+ OLD_SEVERITY INTEGER,
+ NEW_SEVERITY INTEGER,
+ primary key (id)
+);
+CREATE INDEX ACTIVE_RULE_CHANGES_PID ON ACTIVE_RULE_CHANGES (PROFILE_ID);
+
create table ACTIVE_RULE_PARAMETERS (
ID INTEGER not null,
ACTIVE_RULE_ID INTEGER not null,
@@ -33,6 +47,16 @@ create table ACTIVE_RULE_PARAMETERS (
primary key (id)
);
+create table ACTIVE_RULE_PARAM_CHANGES (
+ ID INTEGER not null,
+ ACTIVE_RULE_CHANGE_ID INTEGER not null,
+ RULES_PARAMETER_ID INTEGER not null,
+ OLD_VALUE VARCHAR(4000),
+ NEW_VALUE VARCHAR(4000),
+ primary key (id)
+);
+CREATE INDEX ACTIVE_RULE_PARAM_CHANGES_CID ON ACTIVE_RULE_PARAM_CHANGES (ACTIVE_RULE_CHANGE_ID);
+
create table ALERTS (
ID INTEGER not null,
PROFILE_ID INTEGER,
@@ -362,6 +386,8 @@ create table RULES_PROFILES (
LANGUAGE VARCHAR(16),
PARENT_NAME VARCHAR(100),
ENABLED SMALLINT,
+ VERSION INTEGER not null,
+ USED_PROFILE SMALLINT not null,
primary key (id)
);