aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-core
diff options
context:
space:
mode:
authorDavid Gageot <david@gageot.net>2012-05-10 21:02:19 +0200
committerDavid Gageot <david@gageot.net>2012-05-11 10:35:44 +0200
commit7b400d283a3309d2d64cfaf94c292f832cac92d2 (patch)
treed287cd02c069f27f9b34548549a747d1a859ba7b /sonar-core
parentf3b56ae24cae9ff40879f098916ade30dba79331 (diff)
downloadsonarqube-7b400d283a3309d2d64cfaf94c292f832cac92d2.tar.gz
sonarqube-7b400d283a3309d2d64cfaf94c292f832cac92d2.zip
SONAR-3460 and SONAR-3464 Migration for filters and global dashboards
Diffstat (limited to 'sonar-core')
-rw-r--r--sonar-core/src/main/java/org/sonar/core/persistence/DatabaseUtils.java1
-rw-r--r--sonar-core/src/main/java/org/sonar/core/persistence/DatabaseVersion.java2
-rw-r--r--sonar-core/src/main/resources/org/sonar/core/persistence/rows-derby.sql26
-rw-r--r--sonar-core/src/main/resources/org/sonar/core/persistence/schema-derby.ddl9
4 files changed, 22 insertions, 16 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 dbd8c97e2b1..113301c2f11 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
@@ -40,7 +40,6 @@ public final class DatabaseUtils {
"action_plans",
"action_plans_reviews",
"active_dashboards",
- "active_filters",
"active_rules",
"active_rule_changes",
"active_rule_parameters",
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 d5d6342afd0..63e9ae79b84 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
@@ -32,7 +32,7 @@ import java.util.List;
*/
public class DatabaseVersion implements BatchComponent, ServerComponent {
- public static final int LAST_VERSION = 301;
+ public static final int LAST_VERSION = 302;
public static enum Status {
UP_TO_DATE, REQUIRES_UPGRADE, REQUIRES_DOWNGRADE, FRESH_INSTALL
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 fa11486724e..f9c9c306c8e 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
@@ -1,10 +1,5 @@
-- All the rows inserted during Rails migrations. Rows inserted during server startup tasks (Java) are excluded : rules, profiles, metrics, ...
-INSERT INTO ACTIVE_FILTERS(ID, FILTER_ID, USER_ID, ORDER_INDEX) VALUES (1, 1, null, 1);
-INSERT INTO ACTIVE_FILTERS(ID, FILTER_ID, USER_ID, ORDER_INDEX) VALUES (2, 2, null, 2);
-INSERT INTO ACTIVE_FILTERS(ID, FILTER_ID, USER_ID, ORDER_INDEX) VALUES (3, 3, null, 3);
-ALTER TABLE ACTIVE_FILTERS ALTER COLUMN ID RESTART WITH 4;
-
INSERT INTO CRITERIA(ID, FILTER_ID, FAMILY, KEE, OPERATOR, VALUE, TEXT_VALUE, VARIATION) VALUES (1, 1, 'qualifier', null, '=', null, 'TRK', null);
INSERT INTO CRITERIA(ID, FILTER_ID, FAMILY, KEE, OPERATOR, VALUE, TEXT_VALUE, VARIATION) VALUES (2, 2, 'qualifier', null, '=', null, 'TRK', null);
INSERT INTO CRITERIA(ID, FILTER_ID, FAMILY, KEE, OPERATOR, VALUE, TEXT_VALUE, VARIATION) VALUES (3, 3, 'qualifier', null, '=', null, 'VW,SVW,TRK,BRC,DIR,PAC,FIL,CLA,UTS,LIB', null);
@@ -32,6 +27,26 @@ INSERT INTO FILTERS(ID, NAME, USER_ID, SHARED, FAVOURITES, RESOURCE_ID, DEFAULT_
INSERT INTO FILTERS(ID, NAME, USER_ID, SHARED, FAVOURITES, RESOURCE_ID, DEFAULT_VIEW, PAGE_SIZE, PERIOD_INDEX) VALUES (3, 'My favourites', null, true, true, null, 'list', null, null);
ALTER TABLE FILTERS ALTER COLUMN ID RESTART WITH 4;
+INSERT INTO DASHBOARDS(ID, USER_ID, NAME, DESCRIPTION, COLUMN_LAYOUT, SHARED, IS_GLOBAL) VALUES (1, null, 'Projects', null, '100%', true, true);
+INSERT INTO DASHBOARDS(ID, USER_ID, NAME, DESCRIPTION, COLUMN_LAYOUT, SHARED, IS_GLOBAL) VALUES (2, null, 'Treemap', null, '100%', true, true);
+INSERT INTO DASHBOARDS(ID, USER_ID, NAME, DESCRIPTION, COLUMN_LAYOUT, SHARED, IS_GLOBAL) VALUES (3, null, 'My favourites', null, '100%', true, true);
+ALTER TABLE DASHBOARDS ALTER COLUMN ID RESTART WITH 4;
+
+INSERT INTO ACTIVE_DASHBOARDS(ID, DASHBOARD_ID, USER_ID, ORDER_INDEX) VALUES (1, 1, null, 1);
+INSERT INTO ACTIVE_DASHBOARDS(ID, DASHBOARD_ID, USER_ID, ORDER_INDEX) VALUES (2, 2, null, 2);
+INSERT INTO ACTIVE_DASHBOARDS(ID, DASHBOARD_ID, USER_ID, ORDER_INDEX) VALUES (3, 3, null, 3);
+ALTER TABLE ACTIVE_DASHBOARDS ALTER COLUMN ID RESTART WITH 4;
+
+INSERT INTO WIDGETS(ID, DASHBOARD_ID, WIDGET_KEY, NAME, DESCRIPTION, COLUMN_INDEX, ROW_INDEX, CONFIGURED, RESOURCE_ID) VALUES (1, 1, 'filter', 'Filter', null, 1, 1, true , null);
+INSERT INTO WIDGETS(ID, DASHBOARD_ID, WIDGET_KEY, NAME, DESCRIPTION, COLUMN_INDEX, ROW_INDEX, CONFIGURED, RESOURCE_ID) VALUES (2, 2, 'filter', 'Filter', null, 1, 1, true , null);
+INSERT INTO WIDGETS(ID, DASHBOARD_ID, WIDGET_KEY, NAME, DESCRIPTION, COLUMN_INDEX, ROW_INDEX, CONFIGURED, RESOURCE_ID) VALUES (3, 3, 'filter', 'Filter', null, 1, 1, true , null);
+ALTER TABLE WIDGETS ALTER COLUMN ID RESTART WITH 4;
+
+INSERT INTO WIDGET_PROPERTIES(ID, WIDGET_ID, KEE, TEXT_VALUE) VALUES (1, 1, 'filter', '1');
+INSERT INTO WIDGET_PROPERTIES(ID, WIDGET_ID, KEE, TEXT_VALUE) VALUES (2, 2, 'filter', '2');
+INSERT INTO WIDGET_PROPERTIES(ID, WIDGET_ID, KEE, TEXT_VALUE) VALUES (3, 3, 'filter', '3');
+ALTER TABLE WIDGET_PROPERTIES ALTER COLUMN ID RESTART WITH 4;
+
INSERT INTO GROUP_ROLES(ID, GROUP_ID, RESOURCE_ID, ROLE) VALUES (1, 1, null, 'admin');
INSERT INTO GROUP_ROLES(ID, GROUP_ID, RESOURCE_ID, ROLE) VALUES (2, 1, null, 'default-admin');
INSERT INTO GROUP_ROLES(ID, GROUP_ID, RESOURCE_ID, ROLE) VALUES (3, 2, null, 'default-user');
@@ -189,6 +204,7 @@ INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('286');
INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('287');
INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('300');
INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('301');
+INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('302');
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 7fc40b9ab99..9233e1b9a57 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
@@ -319,13 +319,6 @@ CREATE TABLE "REVIEWS" (
"MANUAL_SEVERITY" BOOLEAN NOT NULL
);
-CREATE TABLE "ACTIVE_FILTERS" (
- "ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1),
- "FILTER_ID" INTEGER,
- "USER_ID" INTEGER,
- "ORDER_INDEX" INTEGER
-);
-
CREATE TABLE "MANUAL_MEASURES" (
"ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1),
"METRIC_ID" INTEGER NOT NULL,
@@ -664,8 +657,6 @@ ALTER TABLE "CHARACTERISTICS" ADD CONSTRAINT "SQL110927104439450" PRIMARY KEY ("
ALTER TABLE "RULES_PARAMETERS" ADD CONSTRAINT "SQL110927104437130" PRIMARY KEY ("ID");
-ALTER TABLE "ACTIVE_FILTERS" ADD CONSTRAINT "SQL110927104438740" PRIMARY KEY ("ID");
-
ALTER TABLE "ACTIVE_DASHBOARDS" ADD CONSTRAINT "SQL110927104439710" PRIMARY KEY ("ID");
ALTER TABLE "FILTER_COLUMNS" ADD CONSTRAINT "SQL110927104438710" PRIMARY KEY ("ID");