diff options
author | Jean-Baptiste Lievremont <jean-baptiste.lievremont@sonarsource.com> | 2013-12-17 15:28:29 +0100 |
---|---|---|
committer | Jean-Baptiste Lievremont <jean-baptiste.lievremont@sonarsource.com> | 2013-12-17 15:28:47 +0100 |
commit | 2b0c4c74255ef30626a23f8e0a9ad43fe756c8b8 (patch) | |
tree | 026cfe07ed7b6f12db9bfbfd46a65edf4e68c0ba /sonar-core/src/main | |
parent | 34857ffd06e8c958afd70656740e51895ff4ca1b (diff) | |
download | sonarqube-2b0c4c74255ef30626a23f8e0a9ad43fe756c8b8.tar.gz sonarqube-2b0c4c74255ef30626a23f8e0a9ad43fe756c8b8.zip |
Start migrating extended descriptions and active rule notes to parent tables
Diffstat (limited to 'sonar-core/src/main')
5 files changed, 57 insertions, 5 deletions
diff --git a/sonar-core/src/main/java/org/sonar/core/persistence/DatabaseVersion.java b/sonar-core/src/main/java/org/sonar/core/persistence/DatabaseVersion.java index 7f0c9e92b43..79b894f1677 100644 --- a/sonar-core/src/main/java/org/sonar/core/persistence/DatabaseVersion.java +++ b/sonar-core/src/main/java/org/sonar/core/persistence/DatabaseVersion.java @@ -33,7 +33,7 @@ import java.util.List; */ public class DatabaseVersion implements BatchComponent, ServerComponent { - public static final int LAST_VERSION = 466; + public static final int LAST_VERSION = 481; public static enum Status { UP_TO_DATE, REQUIRES_UPGRADE, REQUIRES_DOWNGRADE, FRESH_INSTALL diff --git a/sonar-core/src/main/java/org/sonar/core/qualityprofile/db/ActiveRuleDto.java b/sonar-core/src/main/java/org/sonar/core/qualityprofile/db/ActiveRuleDto.java index 1810c6854a5..f04dd148cb8 100644 --- a/sonar-core/src/main/java/org/sonar/core/qualityprofile/db/ActiveRuleDto.java +++ b/sonar-core/src/main/java/org/sonar/core/qualityprofile/db/ActiveRuleDto.java @@ -20,6 +20,8 @@ package org.sonar.core.qualityprofile.db; +import java.util.Date; + public class ActiveRuleDto { private Integer id; @@ -27,6 +29,10 @@ public class ActiveRuleDto { private Integer ruleId; private Integer severity; private String inheritance; + private Date noteCreatedAt; + private Date noteUpdatedAt; + private String noteUserLogin; + private String noteData; public Integer getId() { return id; @@ -72,4 +78,36 @@ public class ActiveRuleDto { this.inheritance = inheritance; return this; } + + public Date getNoteCreatedAt() { + return noteCreatedAt; + } + + public void setNoteCreatedAt(Date noteCreatedAt) { + this.noteCreatedAt = noteCreatedAt; + } + + public Date getNoteUpdatedAt() { + return noteUpdatedAt; + } + + public void setNoteUpdatedAt(Date noteUpdatedAt) { + this.noteUpdatedAt = noteUpdatedAt; + } + + public String getNoteUserLogin() { + return noteUserLogin; + } + + public void setNoteUserLogin(String noteUserLogin) { + this.noteUserLogin = noteUserLogin; + } + + public String getNoteData() { + return noteData; + } + + public void setNoteData(String noteData) { + this.noteData = noteData; + } } diff --git a/sonar-core/src/main/resources/org/sonar/core/persistence/rows-h2.sql b/sonar-core/src/main/resources/org/sonar/core/persistence/rows-h2.sql index 0d7310e4347..6903625df31 100644 --- a/sonar-core/src/main/resources/org/sonar/core/persistence/rows-h2.sql +++ b/sonar-core/src/main/resources/org/sonar/core/persistence/rows-h2.sql @@ -190,6 +190,8 @@ INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('463'); INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('464'); INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('465'); INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('466'); +INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('480'); +INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('481'); 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; diff --git a/sonar-core/src/main/resources/org/sonar/core/persistence/schema-h2.ddl b/sonar-core/src/main/resources/org/sonar/core/persistence/schema-h2.ddl index 8f6ee44a95b..f0ebea6fca1 100644 --- a/sonar-core/src/main/resources/org/sonar/core/persistence/schema-h2.ddl +++ b/sonar-core/src/main/resources/org/sonar/core/persistence/schema-h2.ddl @@ -153,6 +153,10 @@ CREATE TABLE "RULES" ( "LANGUAGE" VARCHAR(20), "CREATED_AT" TIMESTAMP, "UPDATED_AT" TIMESTAMP, + "NOTE_CREATED_AT" TIMESTAMP, + "NOTE_UPDATED_AT" TIMESTAMP, + "NOTE_USER_LOGIN" VARCHAR(40), + "NOTE_DATA" CLOB(2147483647) ); CREATE TABLE "WIDGET_PROPERTIES" ( @@ -285,7 +289,11 @@ CREATE TABLE "ACTIVE_RULES" ( "PROFILE_ID" INTEGER NOT NULL, "RULE_ID" INTEGER NOT NULL, "FAILURE_LEVEL" INTEGER NOT NULL, - "INHERITANCE" VARCHAR(10) + "INHERITANCE" VARCHAR(10), + "NOTE_CREATED_AT" TIMESTAMP, + "NOTE_UPDATED_AT" TIMESTAMP, + "NOTE_USER_LOGIN" VARCHAR(40), + "NOTE_DATA" CLOB(2147483647) ); CREATE TABLE "NOTIFICATIONS" ( diff --git a/sonar-core/src/main/resources/org/sonar/core/qualityprofile/db/ActiveRuleMapper.xml b/sonar-core/src/main/resources/org/sonar/core/qualityprofile/db/ActiveRuleMapper.xml index f7178820d9d..e47f8f4abae 100644 --- a/sonar-core/src/main/resources/org/sonar/core/qualityprofile/db/ActiveRuleMapper.xml +++ b/sonar-core/src/main/resources/org/sonar/core/qualityprofile/db/ActiveRuleMapper.xml @@ -9,12 +9,16 @@ p.rule_id as ruleId, p.failure_level as severity, p.version as version, - p.used_profile as used + p.used_profile as used, + p.note_created_at, + p.note_updated_at, + p.note_user_login, + p.note_data </sql> <insert id="insert" parameterType="ActiveRule" keyColumn="id" useGeneratedKeys="true" keyProperty="id"> - INSERT INTO active_rules (profile_id, rule_id, failure_level, inheritance) - VALUES (#{profileId}, #{ruleId}, #{severity}, #{inheritance}) + INSERT INTO active_rules (profile_id, rule_id, failure_level, inheritance, note_created_at, note_updated_at, note_user_login, note_data) + VALUES (#{profileId}, #{ruleId}, #{severity}, #{inheritance}, #{noteCreatedAt}, #{noteUpdatedAt}, #{noteUserLogin}, #{noteData}) </insert> <insert id="insertParameter" parameterType="ActiveRuleParam" keyColumn="id" useGeneratedKeys="true" keyProperty="id"> |