aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-core/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-core/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-core/src/main')
-rw-r--r--sonar-core/src/main/java/org/sonar/jpa/entity/SchemaMigration.java2
-rw-r--r--sonar-core/src/main/resources/META-INF/persistence.xml4
2 files changed, 4 insertions, 2 deletions
diff --git a/sonar-core/src/main/java/org/sonar/jpa/entity/SchemaMigration.java b/sonar-core/src/main/java/org/sonar/jpa/entity/SchemaMigration.java
index 039029276d7..25351acce12 100644
--- a/sonar-core/src/main/java/org/sonar/jpa/entity/SchemaMigration.java
+++ b/sonar-core/src/main/java/org/sonar/jpa/entity/SchemaMigration.java
@@ -40,7 +40,7 @@ public class SchemaMigration {
- complete the Derby DDL file used for unit tests : sonar-testing-harness/src/main/resources/org/sonar/test/persistence/sonar-test.ddl
*/
- public static final int LAST_VERSION = 201;
+ public static final int LAST_VERSION = 202;
public final static String TABLE_NAME = "schema_migrations";
diff --git a/sonar-core/src/main/resources/META-INF/persistence.xml b/sonar-core/src/main/resources/META-INF/persistence.xml
index 304887e52b7..4d287d8a0df 100644
--- a/sonar-core/src/main/resources/META-INF/persistence.xml
+++ b/sonar-core/src/main/resources/META-INF/persistence.xml
@@ -35,7 +35,9 @@
<class>org.sonar.api.database.model.AsyncMeasureSnapshot</class>
<class>org.sonar.api.batch.Event</class>
<class>org.sonar.api.profiles.Alert</class>
-
+ <class>org.sonar.api.rules.ActiveRuleChange</class>
+ <class>org.sonar.api.rules.ActiveRuleParamChange</class>
+
<properties>
<property name="hibernate.current_session_context_class" value="thread"/>
<property name="hibernate.connection.release_mode" value="after_transaction"/>