aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-core
diff options
context:
space:
mode:
authorFabrice Bellingard <bellingard@gmail.com>2012-01-20 10:56:56 +0100
committerFabrice Bellingard <bellingard@gmail.com>2012-01-23 19:23:18 +0100
commit2044f95a1c1064f2cde28df0c33af633fdd8d8a2 (patch)
tree04dd4aac0e07726d417d4bded646ba0e7c455f62 /sonar-core
parent2095f5221c41f4df2b3d19b1f880181a092ffc99 (diff)
downloadsonarqube-2044f95a1c1064f2cde28df0c33af633fdd8d8a2.tar.gz
sonarqube-2044f95a1c1064f2cde28df0c33af633fdd8d8a2.zip
SONAR-1492 Allow notes per quality rule
=> DB stuff & Ruby models implemented
Diffstat (limited to 'sonar-core')
-rw-r--r--sonar-core/src/main/java/org/sonar/core/persistence/DatabaseUtils.java4
-rw-r--r--sonar-core/src/main/java/org/sonar/jpa/entity/SchemaMigration.java2
-rw-r--r--sonar-core/src/main/resources/org/sonar/core/persistence/rows-derby.sql1
-rw-r--r--sonar-core/src/main/resources/org/sonar/core/persistence/schema-derby.ddl26
4 files changed, 31 insertions, 2 deletions
diff --git a/sonar-core/src/main/java/org/sonar/core/persistence/DatabaseUtils.java b/sonar-core/src/main/java/org/sonar/core/persistence/DatabaseUtils.java
index 814c1ee26e2..be14f84242f 100644
--- a/sonar-core/src/main/java/org/sonar/core/persistence/DatabaseUtils.java
+++ b/sonar-core/src/main/java/org/sonar/core/persistence/DatabaseUtils.java
@@ -43,6 +43,7 @@ public final class DatabaseUtils {
"active_filters",
"active_rules",
"active_rule_changes",
+ "active_rule_notes",
"active_rule_parameters",
"active_rule_param_changes",
"alerts",
@@ -72,11 +73,12 @@ public final class DatabaseUtils {
"resource_index",
"reviews",
"review_comments",
+ "rule_failures",
+ "rule_notes",
"rules",
"rules_categories",
"rules_parameters",
"rules_profiles",
- "rule_failures",
"schema_migrations",
"snapshots",
"snapshot_sources",
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 f0f7a12456a..5efe3e48193 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
@@ -34,7 +34,7 @@ public class SchemaMigration {
public final static int VERSION_UNKNOWN = -1;
- public static final int LAST_VERSION = 251;
+ public static final int LAST_VERSION = 252;
public static final int VERSION_2_13 = 241;
public final static String TABLE_NAME = "schema_migrations";
diff --git a/sonar-core/src/main/resources/org/sonar/core/persistence/rows-derby.sql b/sonar-core/src/main/resources/org/sonar/core/persistence/rows-derby.sql
index 8144ad8cb05..02a2b5895b5 100644
--- a/sonar-core/src/main/resources/org/sonar/core/persistence/rows-derby.sql
+++ b/sonar-core/src/main/resources/org/sonar/core/persistence/rows-derby.sql
@@ -170,6 +170,7 @@ INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('240');
INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('241');
INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('250');
INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('251');
+INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('252');
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-derby.ddl b/sonar-core/src/main/resources/org/sonar/core/persistence/schema-derby.ddl
index 81491225d86..6ddd00a816b 100644
--- a/sonar-core/src/main/resources/org/sonar/core/persistence/schema-derby.ddl
+++ b/sonar-core/src/main/resources/org/sonar/core/persistence/schema-derby.ddl
@@ -486,6 +486,24 @@ CREATE TABLE "ACTION_PLANS_REVIEWS" (
"REVIEW_ID" INTEGER
);
+CREATE TABLE "ACTIVE_RULE_NOTES" (
+ "ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1),
+ "ACTIVE_RULE_ID" INTEGER,
+ "USER_LOGIN" VARCHAR(40),
+ "DATA" BLOB(2147483647),
+ "CREATED_AT" TIMESTAMP,
+ "UPDATED_AT" TIMESTAMP
+);
+
+CREATE TABLE "RULE_NOTES" (
+ "ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1),
+ "RULE_ID" INTEGER,
+ "USER_LOGIN" VARCHAR(40),
+ "DATA" BLOB(2147483647),
+ "CREATED_AT" TIMESTAMP,
+ "UPDATED_AT" TIMESTAMP
+);
+
-- ----------------------------------------------
-- DDL Statements for indexes
@@ -579,6 +597,10 @@ CREATE INDEX "INDEX_ACTION_PLANS_REVIEWS_ON_ACTION_PLAN_ID" ON "ACTION_PLANS_REV
CREATE INDEX "INDEX_ACTION_PLANS_REVIEWS_ON_REVIEW_ID" ON "ACTION_PLANS_REVIEWS" ("REVIEW_ID");
+CREATE INDEX "INDEX_ACTIVE_RULE_NOTES_ON_ACTIVE_RULE_ID" ON "ACTIVE_RULE_NOTES" ("ACTIVE_RULE_ID");
+
+CREATE INDEX "INDEX_RULE_NOTES_ON_ACTIVE_RULE_ID" ON "RULE_NOTES" ("RULE_ID");
+
-- ----------------------------------------------
-- DDL Statements for keys
@@ -666,3 +688,7 @@ ALTER TABLE "ACTIVE_RULE_PARAMETERS" ADD CONSTRAINT "SQL110927104437560" PRIMARY
ALTER TABLE "LOADED_TEMPLATES" ADD CONSTRAINT "SQL110927104437650" PRIMARY KEY ("ID");
ALTER TABLE "ACTION_PLANS" ADD CONSTRAINT "SQL110927104447650" PRIMARY KEY ("ID");
+
+ALTER TABLE "ACTIVE_RULE_NOTES" ADD CONSTRAINT "SQL110927104847650" PRIMARY KEY ("ID");
+
+ALTER TABLE "RULE_NOTES" ADD CONSTRAINT "SQL110927184847650" PRIMARY KEY ("ID");