aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEvgeny Mandrikov <mandrikov@gmail.com>2011-11-23 16:17:34 +0400
committerEvgeny Mandrikov <mandrikov@gmail.com>2011-11-23 17:20:52 +0400
commit5de4905238544859c5abcc87acde1f6a0fa2459d (patch)
tree5523ae8dadb64936e9e5f6e1543005e81b81e727
parentaaed40e6d57e48340334b6ea27da091f20578fa6 (diff)
downloadsonarqube-5de4905238544859c5abcc87acde1f6a0fa2459d.tar.gz
sonarqube-5de4905238544859c5abcc87acde1f6a0fa2459d.zip
Reformat schema-derby.ddl and remove unused sonar-test.ddl
-rw-r--r--sonar-core/src/main/resources/org/sonar/persistence/schema-derby.ddl532
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/db/migrate/README.txt5
-rw-r--r--sonar-testing-harness/src/main/resources/org/sonar/test/persistence/sonar-test.ddl501
3 files changed, 448 insertions, 590 deletions
diff --git a/sonar-core/src/main/resources/org/sonar/persistence/schema-derby.ddl b/sonar-core/src/main/resources/org/sonar/persistence/schema-derby.ddl
index 5a3672b6dd1..70f02367dc4 100644
--- a/sonar-core/src/main/resources/org/sonar/persistence/schema-derby.ddl
+++ b/sonar-core/src/main/resources/org/sonar/persistence/schema-derby.ddl
@@ -5,91 +5,451 @@
-- 2. execute $DERBY_HOME/bin/dblook -d 'jdbc:derby://localhost:1527/sonar;user=sonar;password=sonar' -o /derby.ddl
-- 3. copy the generated derby.ddl into this file
-CREATE TABLE "QUALITY_MODELS" ("ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), "NAME" VARCHAR(100));
-
-CREATE TABLE "GROUPS_USERS" ("USER_ID" INTEGER, "GROUP_ID" INTEGER);
-
-CREATE TABLE "CHARACTERISTIC_EDGES" ("CHILD_ID" INTEGER, "PARENT_ID" INTEGER);
-
-CREATE TABLE "CRITERIA" ("ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), "FILTER_ID" INTEGER, "FAMILY" VARCHAR(100), "KEE" VARCHAR(100), "OPERATOR" VARCHAR(20), "VALUE" DECIMAL(30,20), "TEXT_VALUE" VARCHAR(256), "VARIATION" BOOLEAN);
-
-CREATE TABLE "DEPENDENCIES" ("ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), "FROM_SNAPSHOT_ID" INTEGER, "FROM_RESOURCE_ID" INTEGER, "TO_SNAPSHOT_ID" INTEGER, "TO_RESOURCE_ID" INTEGER, "DEP_USAGE" VARCHAR(30), "DEP_WEIGHT" INTEGER, "PROJECT_SNAPSHOT_ID" INTEGER, "PARENT_DEPENDENCY_ID" BIGINT, "FROM_SCOPE" VARCHAR(3), "TO_SCOPE" VARCHAR(3));
-
-CREATE TABLE "CHARACTERISTICS" ("ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), "QUALITY_MODEL_ID" INTEGER, "KEE" VARCHAR(100), "NAME" VARCHAR(100), "RULE_ID" INTEGER, "DEPTH" INTEGER, "CHARACTERISTIC_ORDER" INTEGER, "DESCRIPTION" VARCHAR(4000), "ENABLED" BOOLEAN);
-
-CREATE TABLE "RULES_PARAMETERS" ("ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), "RULE_ID" INTEGER NOT NULL, "NAME" VARCHAR(128) NOT NULL, "PARAM_TYPE" VARCHAR(512) NOT NULL, "DEFAULT_VALUE" VARCHAR(4000), "DESCRIPTION" VARCHAR(4000));
-
-CREATE TABLE "RULES_PROFILES" ("ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), "NAME" VARCHAR(100) NOT NULL, "DEFAULT_PROFILE" BOOLEAN DEFAULT FALSE, "PROVIDED" BOOLEAN NOT NULL DEFAULT FALSE, "LANGUAGE" VARCHAR(16), "PARENT_NAME" VARCHAR(100), "ENABLED" BOOLEAN NOT NULL DEFAULT TRUE, "VERSION" INTEGER DEFAULT 1, "USED_PROFILE" BOOLEAN DEFAULT FALSE);
-
-CREATE TABLE "WIDGETS" ("ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), "DASHBOARD_ID" INTEGER NOT NULL, "WIDGET_KEY" VARCHAR(256) NOT NULL, "NAME" VARCHAR(256), "DESCRIPTION" VARCHAR(1000), "COLUMN_INDEX" INTEGER, "ROW_INDEX" INTEGER, "CONFIGURED" BOOLEAN, "CREATED_AT" TIMESTAMP, "UPDATED_AT" TIMESTAMP);
-
-CREATE TABLE "FILTER_COLUMNS" ("ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), "FILTER_ID" INTEGER, "FAMILY" VARCHAR(100), "KEE" VARCHAR(100), "SORT_DIRECTION" VARCHAR(5), "ORDER_INDEX" INTEGER, "VARIATION" BOOLEAN);
-
-CREATE TABLE "MEASURE_DATA" ("ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), "MEASURE_ID" INTEGER, "SNAPSHOT_ID" INTEGER, "DATA" BLOB(2147483647));
-
-CREATE TABLE "GROUPS" ("ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), "NAME" VARCHAR(40), "DESCRIPTION" VARCHAR(200), "CREATED_AT" TIMESTAMP, "UPDATED_AT" TIMESTAMP);
-
-CREATE TABLE "ACTIVE_RULE_PARAM_CHANGES" ("ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), "ACTIVE_RULE_CHANGE_ID" INTEGER NOT NULL, "RULES_PARAMETER_ID" INTEGER NOT NULL, "OLD_VALUE" VARCHAR(4000), "NEW_VALUE" VARCHAR(4000));
-
-CREATE TABLE "SNAPSHOTS" ("ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), "CREATED_AT" TIMESTAMP, "PROJECT_ID" INTEGER NOT NULL, "PARENT_SNAPSHOT_ID" INTEGER, "STATUS" VARCHAR(4) NOT NULL DEFAULT 'U', "ISLAST" BOOLEAN NOT NULL DEFAULT FALSE, "SCOPE" VARCHAR(3), "QUALIFIER" VARCHAR(3), "ROOT_SNAPSHOT_ID" INTEGER, "VERSION" VARCHAR(60), "PATH" VARCHAR(96), "DEPTH" INTEGER, "ROOT_PROJECT_ID" INTEGER, "PERIOD1_MODE" VARCHAR(100), "PERIOD1_PARAM" VARCHAR(100), "PERIOD1_DATE" TIMESTAMP, "PERIOD2_MODE" VARCHAR(100), "PERIOD2_PARAM" VARCHAR(100), "PERIOD2_DATE" TIMESTAMP, "PERIOD3_MODE" VARCHAR(100), "PERIOD3_PARAM" VARCHAR(100), "PERIOD3_DATE" TIMESTAMP, "PERIOD4_MODE" VARCHAR(100), "PERIOD4_PARAM" VARCHAR(100), "PERIOD4_DATE" TIMESTAMP, "PERIOD5_MODE" VARCHAR(100), "PERIOD5_PARAM" VARCHAR(100), "PERIOD5_DATE" TIMESTAMP);
-
-CREATE TABLE "SCHEMA_MIGRATIONS" ("VERSION" VARCHAR(256) NOT NULL);
-
-CREATE TABLE "GROUP_ROLES" ("ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), "GROUP_ID" INTEGER, "RESOURCE_ID" INTEGER, "ROLE" VARCHAR(64) NOT NULL);
-
-CREATE TABLE "RULES" ("ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), "PLUGIN_RULE_KEY" VARCHAR(200) NOT NULL, "PLUGIN_NAME" VARCHAR(255) NOT NULL, "DESCRIPTION" CLOB(2147483647), "PRIORITY" INTEGER, "ENABLED" BOOLEAN, "CARDINALITY" VARCHAR(10), "PARENT_ID" INTEGER, "PLUGIN_CONFIG_KEY" VARCHAR(500), "NAME" VARCHAR(200));
-
-CREATE TABLE "WIDGET_PROPERTIES" ("ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), "WIDGET_ID" INTEGER NOT NULL, "KEE" VARCHAR(100), "TEXT_VALUE" VARCHAR(4000), "VALUE_TYPE" VARCHAR(20));
-
-CREATE TABLE "EVENTS" ("ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), "NAME" VARCHAR(400), "RESOURCE_ID" INTEGER, "SNAPSHOT_ID" INTEGER, "CATEGORY" VARCHAR(50), "EVENT_DATE" TIMESTAMP, "CREATED_AT" TIMESTAMP, "DESCRIPTION" VARCHAR(4000));
-
-CREATE TABLE "ALERTS" ("ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), "PROFILE_ID" INTEGER, "METRIC_ID" INTEGER, "OPERATOR" VARCHAR(3), "VALUE_ERROR" VARCHAR(64), "VALUE_WARNING" VARCHAR(64));
-
-CREATE TABLE "PROPERTIES" ("ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), "PROP_KEY" VARCHAR(512), "RESOURCE_ID" INTEGER, "TEXT_VALUE" CLOB(2147483647), "USER_ID" INTEGER);
-
-CREATE TABLE "PROJECT_LINKS" ("ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), "PROJECT_ID" INTEGER NOT NULL, "LINK_TYPE" VARCHAR(20), "NAME" VARCHAR(128), "HREF" VARCHAR(2048) NOT NULL);
-
-CREATE TABLE "DUPLICATIONS_INDEX" ("ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), "PROJECT_SNAPSHOT_ID" INTEGER NOT NULL, "SNAPSHOT_ID" INTEGER NOT NULL, "HASH" VARCHAR(50) NOT NULL, "INDEX_IN_FILE" INTEGER NOT NULL, "START_LINE" INTEGER NOT NULL, "END_LINE" INTEGER NOT NULL);
-
-CREATE TABLE "REVIEW_COMMENTS" ("ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), "CREATED_AT" TIMESTAMP, "UPDATED_AT" TIMESTAMP, "REVIEW_ID" INTEGER, "USER_ID" INTEGER, "REVIEW_TEXT" CLOB(2147483647));
-
-CREATE TABLE "ACTIVE_RULE_CHANGES" ("ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), "USER_NAME" VARCHAR(200) NOT NULL, "PROFILE_ID" INTEGER NOT NULL, "PROFILE_VERSION" INTEGER NOT NULL, "RULE_ID" INTEGER NOT NULL, "CHANGE_DATE" TIMESTAMP NOT NULL, "ENABLED" BOOLEAN, "OLD_SEVERITY" INTEGER, "NEW_SEVERITY" INTEGER);
-
-CREATE TABLE "PROJECT_MEASURES" ("ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), "VALUE" DECIMAL(30,20), "METRIC_ID" INTEGER NOT NULL, "SNAPSHOT_ID" INTEGER, "RULE_ID" INTEGER, "RULES_CATEGORY_ID" INTEGER, "TEXT_VALUE" VARCHAR(96), "TENDENCY" INTEGER, "MEASURE_DATE" TIMESTAMP, "PROJECT_ID" INTEGER, "ALERT_STATUS" VARCHAR(5), "ALERT_TEXT" VARCHAR(4000), "URL" VARCHAR(2000), "DESCRIPTION" VARCHAR(4000), "RULE_PRIORITY" INTEGER, "CHARACTERISTIC_ID" INTEGER, "VARIATION_VALUE_1" DECIMAL(30,20), "VARIATION_VALUE_2" DECIMAL(30,20), "VARIATION_VALUE_3" DECIMAL(30,20), "VARIATION_VALUE_4" DECIMAL(30,20), "VARIATION_VALUE_5" DECIMAL(30,20));
-
-CREATE TABLE "SNAPSHOT_SOURCES" ("ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), "SNAPSHOT_ID" INTEGER NOT NULL, "DATA" CLOB(2147483647));
-
-CREATE TABLE "PROJECTS" ("ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), "NAME" VARCHAR(256), "DESCRIPTION" VARCHAR(2000), "ENABLED" BOOLEAN NOT NULL DEFAULT TRUE, "SCOPE" VARCHAR(3), "QUALIFIER" VARCHAR(3), "KEE" VARCHAR(400), "ROOT_ID" INTEGER, "PROFILE_ID" INTEGER, "LANGUAGE" VARCHAR(5), "COPY_RESOURCE_ID" INTEGER, "LONG_NAME" VARCHAR(256));
-
-CREATE TABLE "REVIEWS" ("ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), "CREATED_AT" TIMESTAMP, "UPDATED_AT" TIMESTAMP, "USER_ID" INTEGER, "ASSIGNEE_ID" INTEGER, "TITLE" VARCHAR(500), "STATUS" VARCHAR(10), "SEVERITY" VARCHAR(10), "RULE_FAILURE_PERMANENT_ID" INTEGER, "PROJECT_ID" INTEGER, "RESOURCE_ID" INTEGER, "RESOURCE_LINE" INTEGER, "RESOLUTION" VARCHAR(200));
-
-CREATE TABLE "RULES_CATEGORIES" ("ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), "NAME" VARCHAR(255) NOT NULL, "DESCRIPTION" VARCHAR(1000) 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, "RESOURCE_ID" INTEGER, "VALUE" DECIMAL(30,20), "TEXT_VALUE" VARCHAR(4000), "USER_LOGIN" VARCHAR(40), "DESCRIPTION" VARCHAR(4000), "CREATED_AT" TIMESTAMP, "UPDATED_AT" TIMESTAMP);
-
-CREATE TABLE "ACTIVE_RULES" ("ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), "PROFILE_ID" INTEGER NOT NULL, "RULE_ID" INTEGER NOT NULL, "FAILURE_LEVEL" INTEGER NOT NULL, "INHERITANCE" VARCHAR(10));
-
-CREATE TABLE "NOTIFICATIONS" ("ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), "CREATED_AT" TIMESTAMP, "DATA" BLOB(2147483647));
-
-CREATE TABLE "USER_ROLES" ("ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), "USER_ID" INTEGER, "RESOURCE_ID" INTEGER, "ROLE" VARCHAR(64) NOT NULL);
-
-CREATE TABLE "ACTIVE_DASHBOARDS" ("ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), "DASHBOARD_ID" INTEGER NOT NULL, "USER_ID" INTEGER, "ORDER_INDEX" INTEGER);
-
-CREATE TABLE "ACTIVE_RULE_PARAMETERS" ("ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), "ACTIVE_RULE_ID" INTEGER NOT NULL, "RULES_PARAMETER_ID" INTEGER NOT NULL, "VALUE" VARCHAR(4000));
-
-CREATE TABLE "CHARACTERISTIC_PROPERTIES" ("ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), "CHARACTERISTIC_ID" INTEGER, "KEE" VARCHAR(100), "VALUE" DECIMAL(30,20), "TEXT_VALUE" VARCHAR(4000));
-
-CREATE TABLE "USERS" ("ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), "LOGIN" VARCHAR(40), "NAME" VARCHAR(200), "EMAIL" VARCHAR(100), "CRYPTED_PASSWORD" VARCHAR(40), "SALT" VARCHAR(40), "CREATED_AT" TIMESTAMP, "UPDATED_AT" TIMESTAMP, "REMEMBER_TOKEN" VARCHAR(500), "REMEMBER_TOKEN_EXPIRES_AT" TIMESTAMP);
-
-CREATE TABLE "FILTERS" ("ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), "NAME" VARCHAR(100), "USER_ID" INTEGER, "SHARED" BOOLEAN, "FAVOURITES" BOOLEAN, "RESOURCE_ID" INTEGER, "DEFAULT_VIEW" VARCHAR(20), "PAGE_SIZE" INTEGER, "PERIOD_INDEX" INTEGER);
-
-CREATE TABLE "DASHBOARDS" ("ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), "USER_ID" INTEGER, "NAME" VARCHAR(256), "DESCRIPTION" VARCHAR(1000), "COLUMN_LAYOUT" VARCHAR(20), "SHARED" BOOLEAN, "CREATED_AT" TIMESTAMP, "UPDATED_AT" TIMESTAMP);
-
-CREATE TABLE "RULE_FAILURES" ("ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), "SNAPSHOT_ID" INTEGER NOT NULL, "RULE_ID" INTEGER NOT NULL, "FAILURE_LEVEL" INTEGER NOT NULL, "MESSAGE" VARCHAR(4000), "LINE" INTEGER, "COST" DECIMAL(30,20), "CREATED_AT" TIMESTAMP, "CHECKSUM" VARCHAR(1000), "PERMANENT_ID" INTEGER, "SWITCHED_OFF" BOOLEAN);
-
-CREATE TABLE "METRICS" ("ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), "NAME" VARCHAR(64) NOT NULL, "DESCRIPTION" VARCHAR(255), "DIRECTION" INTEGER NOT NULL DEFAULT 0, "DOMAIN" VARCHAR(64), "SHORT_NAME" VARCHAR(64), "QUALITATIVE" BOOLEAN NOT NULL DEFAULT FALSE, "VAL_TYPE" VARCHAR(8), "USER_MANAGED" BOOLEAN DEFAULT FALSE, "ENABLED" BOOLEAN DEFAULT TRUE, "ORIGIN" VARCHAR(3), "WORST_VALUE" DECIMAL(30,20), "BEST_VALUE" DECIMAL(30,20), "OPTIMIZED_BEST_VALUE" BOOLEAN, "HIDDEN" BOOLEAN);
+CREATE TABLE "QUALITY_MODELS" (
+ "ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1),
+ "NAME" VARCHAR(100)
+);
+
+CREATE TABLE "GROUPS_USERS" (
+ "USER_ID" INTEGER,
+ "GROUP_ID" INTEGER
+);
+
+CREATE TABLE "CHARACTERISTIC_EDGES" (
+ "CHILD_ID" INTEGER,
+ "PARENT_ID" INTEGER
+);
+
+CREATE TABLE "CRITERIA" (
+ "ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1),
+ "FILTER_ID" INTEGER,
+ "FAMILY" VARCHAR(100),
+ "KEE" VARCHAR(100),
+ "OPERATOR" VARCHAR(20),
+ "VALUE" DECIMAL(30,20),
+ "TEXT_VALUE" VARCHAR(256),
+ "VARIATION" BOOLEAN
+);
+
+CREATE TABLE "DEPENDENCIES" (
+ "ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1),
+ "FROM_SNAPSHOT_ID" INTEGER,
+ "FROM_RESOURCE_ID" INTEGER,
+ "TO_SNAPSHOT_ID" INTEGER,
+ "TO_RESOURCE_ID" INTEGER,
+ "DEP_USAGE" VARCHAR(30),
+ "DEP_WEIGHT" INTEGER,
+ "PROJECT_SNAPSHOT_ID" INTEGER,
+ "PARENT_DEPENDENCY_ID" BIGINT,
+ "FROM_SCOPE" VARCHAR(3),
+ "TO_SCOPE" VARCHAR(3)
+);
+
+CREATE TABLE "CHARACTERISTICS" (
+ "ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1),
+ "QUALITY_MODEL_ID" INTEGER,
+ "KEE" VARCHAR(100),
+ "NAME" VARCHAR(100),
+ "RULE_ID" INTEGER,
+ "DEPTH" INTEGER,
+ "CHARACTERISTIC_ORDER" INTEGER,
+ "DESCRIPTION" VARCHAR(4000),
+ "ENABLED" BOOLEAN
+);
+
+CREATE TABLE "RULES_PARAMETERS" (
+ "ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1),
+ "RULE_ID" INTEGER NOT NULL,
+ "NAME" VARCHAR(128) NOT NULL,
+ "PARAM_TYPE" VARCHAR(512) NOT NULL,
+ "DEFAULT_VALUE" VARCHAR(4000),
+ "DESCRIPTION" VARCHAR(4000)
+);
+
+CREATE TABLE "RULES_PROFILES" (
+ "ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1),
+ "NAME" VARCHAR(100) NOT NULL,
+ "DEFAULT_PROFILE" BOOLEAN DEFAULT FALSE,
+ "PROVIDED" BOOLEAN NOT NULL DEFAULT FALSE,
+ "LANGUAGE" VARCHAR(16),
+ "PARENT_NAME" VARCHAR(100),
+ "ENABLED" BOOLEAN NOT NULL DEFAULT TRUE,
+ "VERSION" INTEGER DEFAULT 1,
+ "USED_PROFILE" BOOLEAN DEFAULT FALSE
+);
+
+CREATE TABLE "WIDGETS" (
+ "ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1),
+ "DASHBOARD_ID" INTEGER NOT NULL,
+ "WIDGET_KEY" VARCHAR(256) NOT NULL,
+ "NAME" VARCHAR(256),
+ "DESCRIPTION" VARCHAR(1000),
+ "COLUMN_INDEX" INTEGER,
+ "ROW_INDEX" INTEGER,
+ "CONFIGURED" BOOLEAN,
+ "CREATED_AT" TIMESTAMP,
+ "UPDATED_AT" TIMESTAMP
+);
+
+CREATE TABLE "FILTER_COLUMNS" (
+ "ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1),
+ "FILTER_ID" INTEGER,
+ "FAMILY" VARCHAR(100),
+ "KEE" VARCHAR(100),
+ "SORT_DIRECTION" VARCHAR(5),
+ "ORDER_INDEX" INTEGER,
+ "VARIATION" BOOLEAN
+);
+
+CREATE TABLE "MEASURE_DATA" (
+ "ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1),
+ "MEASURE_ID" INTEGER,
+ "SNAPSHOT_ID" INTEGER,
+ "DATA" BLOB(2147483647)
+);
+
+CREATE TABLE "GROUPS" (
+ "ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1),
+ "NAME" VARCHAR(40),
+ "DESCRIPTION" VARCHAR(200),
+ "CREATED_AT" TIMESTAMP,
+ "UPDATED_AT" TIMESTAMP
+);
+
+CREATE TABLE "ACTIVE_RULE_PARAM_CHANGES" (
+ "ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1),
+ "ACTIVE_RULE_CHANGE_ID" INTEGER NOT NULL,
+ "RULES_PARAMETER_ID" INTEGER NOT NULL,
+ "OLD_VALUE" VARCHAR(4000),
+ "NEW_VALUE" VARCHAR(4000)
+);
+
+CREATE TABLE "SNAPSHOTS" (
+ "ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1),
+ "CREATED_AT" TIMESTAMP,
+ "PROJECT_ID" INTEGER NOT NULL,
+ "PARENT_SNAPSHOT_ID" INTEGER,
+ "STATUS" VARCHAR(4) NOT NULL DEFAULT 'U',
+ "ISLAST" BOOLEAN NOT NULL DEFAULT FALSE,
+ "SCOPE" VARCHAR(3),
+ "QUALIFIER" VARCHAR(3),
+ "ROOT_SNAPSHOT_ID" INTEGER,
+ "VERSION" VARCHAR(60),
+ "PATH" VARCHAR(96),
+ "DEPTH" INTEGER,
+ "ROOT_PROJECT_ID" INTEGER,
+ "PERIOD1_MODE" VARCHAR(100),
+ "PERIOD1_PARAM" VARCHAR(100),
+ "PERIOD1_DATE" TIMESTAMP,
+ "PERIOD2_MODE" VARCHAR(100),
+ "PERIOD2_PARAM" VARCHAR(100),
+ "PERIOD2_DATE" TIMESTAMP,
+ "PERIOD3_MODE" VARCHAR(100),
+ "PERIOD3_PARAM" VARCHAR(100),
+ "PERIOD3_DATE" TIMESTAMP,
+ "PERIOD4_MODE" VARCHAR(100),
+ "PERIOD4_PARAM" VARCHAR(100),
+ "PERIOD4_DATE" TIMESTAMP,
+ "PERIOD5_MODE" VARCHAR(100),
+ "PERIOD5_PARAM" VARCHAR(100),
+ "PERIOD5_DATE" TIMESTAMP
+);
+
+CREATE TABLE "SCHEMA_MIGRATIONS" (
+"VERSION" VARCHAR(256) NOT NULL
+);
+
+CREATE TABLE "GROUP_ROLES" (
+ "ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1),
+ "GROUP_ID" INTEGER,
+ "RESOURCE_ID" INTEGER,
+ "ROLE" VARCHAR(64) NOT NULL
+);
+
+CREATE TABLE "RULES" (
+ "ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1),
+ "PLUGIN_RULE_KEY" VARCHAR(200) NOT NULL,
+ "PLUGIN_NAME" VARCHAR(255) NOT NULL,
+ "DESCRIPTION" CLOB(2147483647),
+ "PRIORITY" INTEGER,
+ "ENABLED" BOOLEAN,
+ "CARDINALITY" VARCHAR(10),
+ "PARENT_ID" INTEGER,
+ "PLUGIN_CONFIG_KEY" VARCHAR(500),
+ "NAME" VARCHAR(200)
+);
+
+CREATE TABLE "WIDGET_PROPERTIES" (
+ "ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1),
+ "WIDGET_ID" INTEGER NOT NULL,
+ "KEE" VARCHAR(100),
+ "TEXT_VALUE" VARCHAR(4000),
+ "VALUE_TYPE" VARCHAR(20)
+);
+
+CREATE TABLE "EVENTS" (
+ "ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1),
+ "NAME" VARCHAR(400),
+ "RESOURCE_ID" INTEGER,
+ "SNAPSHOT_ID" INTEGER,
+ "CATEGORY" VARCHAR(50),
+ "EVENT_DATE" TIMESTAMP,
+ "CREATED_AT" TIMESTAMP,
+ "DESCRIPTION" VARCHAR(4000)
+);
+
+CREATE TABLE "ALERTS" (
+ "ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1),
+ "PROFILE_ID" INTEGER,
+ "METRIC_ID" INTEGER,
+ "OPERATOR" VARCHAR(3),
+ "VALUE_ERROR" VARCHAR(64),
+ "VALUE_WARNING" VARCHAR(64)
+);
+
+CREATE TABLE "PROPERTIES" (
+ "ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1),
+ "PROP_KEY" VARCHAR(512),
+ "RESOURCE_ID" INTEGER,
+ "TEXT_VALUE" CLOB(2147483647),
+ "USER_ID" INTEGER
+);
+
+CREATE TABLE "PROJECT_LINKS" (
+ "ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1),
+ "PROJECT_ID" INTEGER NOT NULL,
+ "LINK_TYPE" VARCHAR(20),
+ "NAME" VARCHAR(128),
+ "HREF" VARCHAR(2048) NOT NULL
+);
+
+CREATE TABLE "DUPLICATIONS_INDEX" (
+ "ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1),
+ "PROJECT_SNAPSHOT_ID" INTEGER NOT NULL,
+ "SNAPSHOT_ID" INTEGER NOT NULL,
+ "HASH" VARCHAR(50) NOT NULL,
+ "INDEX_IN_FILE" INTEGER NOT NULL,
+ "START_LINE" INTEGER NOT NULL,
+ "END_LINE" INTEGER NOT NULL
+);
+
+CREATE TABLE "REVIEW_COMMENTS" (
+ "ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1),
+ "CREATED_AT" TIMESTAMP,
+ "UPDATED_AT" TIMESTAMP,
+ "REVIEW_ID" INTEGER,
+ "USER_ID" INTEGER,
+ "REVIEW_TEXT" CLOB(2147483647)
+);
+
+CREATE TABLE "ACTIVE_RULE_CHANGES" (
+ "ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1),
+ "USER_NAME" VARCHAR(200) NOT NULL,
+ "PROFILE_ID" INTEGER NOT NULL,
+ "PROFILE_VERSION" INTEGER NOT NULL,
+ "RULE_ID" INTEGER NOT NULL,
+ "CHANGE_DATE" TIMESTAMP NOT NULL,
+ "ENABLED" BOOLEAN,
+ "OLD_SEVERITY" INTEGER,
+ "NEW_SEVERITY" INTEGER
+);
+
+CREATE TABLE "PROJECT_MEASURES" (
+ "ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1),
+ "VALUE" DECIMAL(30,20),
+ "METRIC_ID" INTEGER NOT NULL,
+ "SNAPSHOT_ID" INTEGER,
+ "RULE_ID" INTEGER,
+ "RULES_CATEGORY_ID" INTEGER,
+ "TEXT_VALUE" VARCHAR(96),
+ "TENDENCY" INTEGER,
+ "MEASURE_DATE" TIMESTAMP,
+ "PROJECT_ID" INTEGER,
+ "ALERT_STATUS" VARCHAR(5),
+ "ALERT_TEXT" VARCHAR(4000),
+ "URL" VARCHAR(2000),
+ "DESCRIPTION" VARCHAR(4000),
+ "RULE_PRIORITY" INTEGER,
+ "CHARACTERISTIC_ID" INTEGER,
+ "VARIATION_VALUE_1" DECIMAL(30,20),
+ "VARIATION_VALUE_2" DECIMAL(30,20),
+ "VARIATION_VALUE_3" DECIMAL(30,20),
+ "VARIATION_VALUE_4" DECIMAL(30,20),
+ "VARIATION_VALUE_5" DECIMAL(30,20)
+);
+
+CREATE TABLE "SNAPSHOT_SOURCES" (
+ "ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1),
+ "SNAPSHOT_ID" INTEGER NOT NULL,
+ "DATA" CLOB(2147483647)
+);
+
+CREATE TABLE "PROJECTS" (
+ "ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1),
+ "NAME" VARCHAR(256),
+ "DESCRIPTION" VARCHAR(2000),
+ "ENABLED" BOOLEAN NOT NULL DEFAULT TRUE,
+ "SCOPE" VARCHAR(3),
+ "QUALIFIER" VARCHAR(3),
+ "KEE" VARCHAR(400),
+ "ROOT_ID" INTEGER,
+ "PROFILE_ID" INTEGER,
+ "LANGUAGE" VARCHAR(5),
+ "COPY_RESOURCE_ID" INTEGER,
+ "LONG_NAME" VARCHAR(256)
+);
+
+CREATE TABLE "REVIEWS" (
+ "ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1),
+ "CREATED_AT" TIMESTAMP,
+ "UPDATED_AT" TIMESTAMP,
+ "USER_ID" INTEGER,
+ "ASSIGNEE_ID" INTEGER,
+ "TITLE" VARCHAR(500),
+ "STATUS" VARCHAR(10),
+ "SEVERITY" VARCHAR(10),
+ "RULE_FAILURE_PERMANENT_ID" INTEGER,
+ "PROJECT_ID" INTEGER,
+ "RESOURCE_ID" INTEGER,
+ "RESOURCE_LINE" INTEGER,
+ "RESOLUTION" VARCHAR(200)
+);
+
+CREATE TABLE "RULES_CATEGORIES" (
+ "ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1),
+ "NAME" VARCHAR(255) NOT NULL,
+ "DESCRIPTION" VARCHAR(1000) 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,
+ "RESOURCE_ID" INTEGER,
+ "VALUE" DECIMAL(30,20),
+ "TEXT_VALUE" VARCHAR(4000),
+ "USER_LOGIN" VARCHAR(40),
+ "DESCRIPTION" VARCHAR(4000),
+ "CREATED_AT" TIMESTAMP,
+ "UPDATED_AT" TIMESTAMP
+);
+
+CREATE TABLE "ACTIVE_RULES" (
+ "ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1),
+ "PROFILE_ID" INTEGER NOT NULL,
+ "RULE_ID" INTEGER NOT NULL,
+ "FAILURE_LEVEL" INTEGER NOT NULL,
+ "INHERITANCE" VARCHAR(10)
+);
+
+CREATE TABLE "NOTIFICATIONS" (
+ "ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1),
+ "CREATED_AT" TIMESTAMP,
+ "DATA" BLOB(2147483647)
+);
+
+CREATE TABLE "USER_ROLES" (
+ "ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1),
+ "USER_ID" INTEGER,
+ "RESOURCE_ID" INTEGER,
+ "ROLE" VARCHAR(64) NOT NULL
+);
+
+CREATE TABLE "ACTIVE_DASHBOARDS" (
+ "ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1),
+ "DASHBOARD_ID" INTEGER NOT NULL,
+ "USER_ID" INTEGER,
+ "ORDER_INDEX" INTEGER
+);
+
+CREATE TABLE "ACTIVE_RULE_PARAMETERS" (
+ "ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1),
+ "ACTIVE_RULE_ID" INTEGER NOT NULL,
+ "RULES_PARAMETER_ID" INTEGER NOT NULL,
+ "VALUE" VARCHAR(4000)
+);
+
+CREATE TABLE "CHARACTERISTIC_PROPERTIES" (
+ "ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1),
+ "CHARACTERISTIC_ID" INTEGER,
+ "KEE" VARCHAR(100),
+ "VALUE" DECIMAL(30,20),
+ "TEXT_VALUE" VARCHAR(4000)
+);
+
+CREATE TABLE "USERS" (
+ "ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1),
+ "LOGIN" VARCHAR(40),
+ "NAME" VARCHAR(200),
+ "EMAIL" VARCHAR(100),
+ "CRYPTED_PASSWORD" VARCHAR(40),
+ "SALT" VARCHAR(40),
+ "CREATED_AT" TIMESTAMP,
+ "UPDATED_AT" TIMESTAMP,
+ "REMEMBER_TOKEN" VARCHAR(500),
+ "REMEMBER_TOKEN_EXPIRES_AT" TIMESTAMP
+);
+
+CREATE TABLE "FILTERS" (
+ "ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1),
+ "NAME" VARCHAR(100),
+ "USER_ID" INTEGER,
+ "SHARED" BOOLEAN,
+ "FAVOURITES" BOOLEAN,
+ "RESOURCE_ID" INTEGER,
+ "DEFAULT_VIEW" VARCHAR(20),
+ "PAGE_SIZE" INTEGER,
+ "PERIOD_INDEX" INTEGER
+);
+
+CREATE TABLE "DASHBOARDS" (
+ "ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1),
+ "USER_ID" INTEGER,
+ "NAME" VARCHAR(256),
+ "DESCRIPTION" VARCHAR(1000),
+ "COLUMN_LAYOUT" VARCHAR(20),
+ "SHARED" BOOLEAN,
+ "CREATED_AT" TIMESTAMP,
+ "UPDATED_AT" TIMESTAMP
+);
+
+CREATE TABLE "RULE_FAILURES" (
+ "ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1),
+ "SNAPSHOT_ID" INTEGER NOT NULL,
+ "RULE_ID" INTEGER NOT NULL,
+ "FAILURE_LEVEL" INTEGER NOT NULL,
+ "MESSAGE" VARCHAR(4000),
+ "LINE" INTEGER,
+ "COST" DECIMAL(30,20),
+ "CREATED_AT" TIMESTAMP,
+ "CHECKSUM" VARCHAR(1000),
+ "PERMANENT_ID" INTEGER,
+ "SWITCHED_OFF" BOOLEAN
+);
+
+CREATE TABLE "METRICS" (
+ "ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1),
+ "NAME" VARCHAR(64) NOT NULL,
+ "DESCRIPTION" VARCHAR(255),
+ "DIRECTION" INTEGER NOT NULL DEFAULT 0,
+ "DOMAIN" VARCHAR(64),
+ "SHORT_NAME" VARCHAR(64),
+ "QUALITATIVE" BOOLEAN NOT NULL DEFAULT FALSE,
+ "VAL_TYPE" VARCHAR(8),
+ "USER_MANAGED" BOOLEAN DEFAULT FALSE,
+ "ENABLED" BOOLEAN DEFAULT TRUE,
+ "ORIGIN" VARCHAR(3),
+ "WORST_VALUE" DECIMAL(30,20),
+ "BEST_VALUE" DECIMAL(30,20),
+ "OPTIMIZED_BEST_VALUE" BOOLEAN,
+ "HIDDEN" BOOLEAN
+);
-- ----------------------------------------------
-- DDL Statements for indexes
@@ -256,4 +616,4 @@ ALTER TABLE "PROJECTS" ADD CONSTRAINT "SQL110927104436930" PRIMARY KEY ("ID");
ALTER TABLE "RULES_PROFILES" ADD CONSTRAINT "SQL110927104437540" PRIMARY KEY ("ID");
-ALTER TABLE "ACTIVE_RULE_PARAMETERS" ADD CONSTRAINT "SQL110927104437560" PRIMARY KEY ("ID"); \ No newline at end of file
+ALTER TABLE "ACTIVE_RULE_PARAMETERS" ADD CONSTRAINT "SQL110927104437560" PRIMARY KEY ("ID");
diff --git a/sonar-server/src/main/webapp/WEB-INF/db/migrate/README.txt b/sonar-server/src/main/webapp/WEB-INF/db/migrate/README.txt
index 94781a7cf53..65920ee80ca 100644
--- a/sonar-server/src/main/webapp/WEB-INF/db/migrate/README.txt
+++ b/sonar-server/src/main/webapp/WEB-INF/db/migrate/README.txt
@@ -3,10 +3,9 @@ HOW TO ADD A MIGRATION
* Jump some versions when adding the first Ruby on Rails migration of a new sonar version. For example if sonar 2.10 is 193, then sonar 2.11 should start at 200.
* Complete the DDL files for Derby :
+ sonar-core/src/main/resources/org/sonar/persistence/schema-derby.ddl
- + complete sonar-core/src/main/resources/org/sonar/persistence/rows-derby.sql :
+ + sonar-core/src/main/resources/org/sonar/persistence/rows-derby.sql :
- add "INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('<THE MIGRATION ID>')"
* Update the migration id defined in sonar-core/src/main/java/org/sonar/jpa/entity/SchemaMigration.java
-* To be removed soon : complete sonar-testing-harness/src/main/resources/org/sonar/test/persistence/sonar-test.ddl
@@ -14,4 +13,4 @@ HOW TO ADD A MIGRATION
RECOMMANDATIONS
* Don't forget that index name limited to 30 characters in Oracle DB.
-* Prefer to add nullable columns to avoid problems during migration. \ No newline at end of file
+* Prefer to add nullable columns to avoid problems during migration.
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
deleted file mode 100644
index 60d8419db75..00000000000
--- a/sonar-testing-harness/src/main/resources/org/sonar/test/persistence/sonar-test.ddl
+++ /dev/null
@@ -1,501 +0,0 @@
-create table ACTIVE_DASHBOARDS (
- ID INTEGER not null,
- DASHBOARD_ID INTEGER not null,
- USER_ID INTEGER,
- ORDER_INDEX INTEGER,
- primary key (id)
-);
-CREATE INDEX ACTIVE_DASHBOARDS_DASHBOARDID ON ACTIVE_DASHBOARDS (DASHBOARD_ID);
-CREATE INDEX ACTIVE_DASHBOARDS_USERID ON ACTIVE_DASHBOARDS (USER_ID);
-
-create table ACTIVE_FILTERS (
- ID INTEGER not null,
- FILTER_ID INTEGER,
- USER_ID INTEGER,
- ORDER_INDEX INTEGER,
- primary key (id)
-);
-
-create table ACTIVE_RULES (
- ID INTEGER not null,
- PROFILE_ID INTEGER not null,
- RULE_ID INTEGER not null,
- FAILURE_LEVEL INTEGER not null,
- INHERITANCE VARCHAR(10),
- primary key (id)
-);
-
-create table ACTIVE_RULE_CHANGES (
- ID INTEGER not null,
- USER_NAME VARCHAR(200) 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,
- RULES_PARAMETER_ID INTEGER not null,
- VALUE VARCHAR(4000),
- 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,
- METRIC_ID INTEGER,
- OPERATOR VARCHAR(3),
- VALUE_ERROR VARCHAR(64),
- VALUE_WARNING VARCHAR(64),
- primary key (id)
-);
-
-create table CHARACTERISTICS (
- ID INTEGER not null,
- QUALITY_MODEL_ID INTEGER,
- KEE VARCHAR(100),
- NAME VARCHAR(100),
- RULE_ID INTEGER,
- DEPTH INTEGER,
- CHARACTERISTIC_ORDER INTEGER,
- DESCRIPTION VARCHAR(4000),
- ENABLED SMALLINT,
- primary key (id)
-);
-
-create table CHARACTERISTIC_EDGES (
- CHILD_ID INTEGER,
- PARENT_ID INTEGER
-);
-
-create table CHARACTERISTIC_PROPERTIES (
- ID INTEGER not null,
- CHARACTERISTIC_ID INTEGER,
- KEE VARCHAR(100),
- VALUE DECIMAL(30, 20),
- TEXT_VALUE VARCHAR(4000),
- primary key (id)
-);
-CREATE INDEX CHARACTERISTIC_PROPERTIES_CID ON CHARACTERISTIC_PROPERTIES (CHARACTERISTIC_ID);
-
-create table CRITERIA (
- ID INTEGER not null,
- FILTER_ID INTEGER,
- FAMILY VARCHAR(100),
- KEE VARCHAR(100),
- OPERATOR VARCHAR(20),
- VALUE DECIMAL(30, 20),
- TEXT_VALUE VARCHAR(256),
- VARIATION SMALLINT,
- primary key (id)
-);
-
-create table DASHBOARDS (
- ID INTEGER not null,
- USER_ID INTEGER,
- NAME VARCHAR(256),
- DESCRIPTION VARCHAR(1000),
- COLUMN_LAYOUT VARCHAR(20),
- SHARED SMALLINT,
- CREATED_AT TIMESTAMP,
- UPDATED_AT TIMESTAMP,
- primary key (id)
-);
-
-create table DEPENDENCIES (
- ID INTEGER not null,
- FROM_SNAPSHOT_ID INTEGER,
- FROM_RESOURCE_ID INTEGER,
- TO_SNAPSHOT_ID INTEGER,
- TO_RESOURCE_ID INTEGER,
- DEP_USAGE VARCHAR(30),
- DEP_WEIGHT INTEGER,
- PROJECT_SNAPSHOT_ID INTEGER,
- PARENT_DEPENDENCY_ID BIGINT,
- FROM_SCOPE VARCHAR(3),
- TO_SCOPE VARCHAR(3),
- primary key (id)
-);
-CREATE INDEX DEPS_FROM_SID ON DEPENDENCIES (FROM_SNAPSHOT_ID);
-CREATE INDEX DEPS_TO_SID ON DEPENDENCIES (TO_SNAPSHOT_ID);
-CREATE INDEX DEPS_PRJ_SID ON DEPENDENCIES (PROJECT_SNAPSHOT_ID);
-
-create table EVENTS (
- ID INTEGER not null,
- NAME VARCHAR(400),
- RESOURCE_ID INTEGER,
- SNAPSHOT_ID INTEGER,
- CATEGORY VARCHAR(50),
- EVENT_DATE TIMESTAMP,
- CREATED_AT TIMESTAMP,
- DESCRIPTION VARCHAR(4000),
- primary key (id)
-);
-CREATE INDEX EVENTS_RESOURCE_ID ON EVENTS (RESOURCE_ID);
-CREATE INDEX EVENTS_SNAPSHOT_ID ON EVENTS (SNAPSHOT_ID);
-
-create table FILTERS (
- ID INTEGER not null,
- NAME VARCHAR(100),
- USER_ID INTEGER,
- SHARED SMALLINT,
- FAVOURITES SMALLINT,
- RESOURCE_ID INTEGER,
- DEFAULT_VIEW VARCHAR(20),
- PAGE_SIZE INTEGER,
- PERIOD_INDEX INTEGER,
- primary key (id)
-);
-
-create table FILTER_COLUMNS (
- ID INTEGER not null,
- FILTER_ID INTEGER,
- FAMILY VARCHAR(100),
- KEE VARCHAR(100),
- SORT_DIRECTION VARCHAR(5),
- ORDER_INDEX INTEGER,
- VARIATION SMALLINT,
- primary key (id)
-);
-
-create table GROUPS (
- ID INTEGER not null,
- NAME VARCHAR(40),
- DESCRIPTION VARCHAR(200),
- CREATED_AT TIMESTAMP,
- UPDATED_AT TIMESTAMP,
- primary key (id)
-);
-
-create table GROUPS_USERS (
- USER_ID INTEGER,
- GROUP_ID INTEGER
-);
-CREATE INDEX INDEX_GROUPS_USERS_ON_GROUP_ID ON GROUPS_USERS (GROUP_ID);
-CREATE INDEX INDEX_GROUPS_USERS_ON_USER_ID ON GROUPS_USERS (USER_ID);
-
-create table GROUP_ROLES (
- ID INTEGER not null,
- GROUP_ID INTEGER,
- RESOURCE_ID INTEGER,
- ROLE VARCHAR(64) not null,
- primary key (id)
-);
-CREATE INDEX GROUP_ROLES_GROUP ON GROUP_ROLES (GROUP_ID);
-CREATE INDEX GROUP_ROLES_RESOURCE ON GROUP_ROLES (RESOURCE_ID);
-
-create table MEASURE_DATA (
- ID INTEGER not null,
- MEASURE_ID INTEGER,
- SNAPSHOT_ID INTEGER,
- DATA BLOB,
- primary key (id)
-);
-CREATE INDEX MEASURE_DATA_MEASURE_ID ON MEASURE_DATA (MEASURE_ID);
-CREATE INDEX M_DATA_SID ON MEASURE_DATA (SNAPSHOT_ID);
-
-create table METRICS (
- ID INTEGER not null,
- NAME VARCHAR(64) not null,
- DESCRIPTION VARCHAR(255),
- DIRECTION INTEGER not null,
- DOMAIN VARCHAR(64),
- SHORT_NAME VARCHAR(64),
- QUALITATIVE SMALLINT,
- VAL_TYPE VARCHAR(8),
- USER_MANAGED SMALLINT,
- ENABLED SMALLINT,
- ORIGIN VARCHAR(3),
- WORST_VALUE DECIMAL(30, 20),
- BEST_VALUE DECIMAL(30, 20),
- OPTIMIZED_BEST_VALUE SMALLINT,
- HIDDEN SMALLINT,
- primary key (id)
-);
-CREATE UNIQUE INDEX METRICS_UNIQUE_NAME ON METRICS (NAME);
-
-create table PROJECTS (
- ID INTEGER not null,
- NAME VARCHAR(256),
- DESCRIPTION VARCHAR(2000),
- ENABLED SMALLINT not null,
- SCOPE VARCHAR(3),
- QUALIFIER VARCHAR(3),
- KEE VARCHAR(400),
- ROOT_ID INTEGER,
- PROFILE_ID INTEGER,
- LANGUAGE VARCHAR(5),
- COPY_RESOURCE_ID INTEGER,
- LONG_NAME VARCHAR(256),
- primary key (id)
-);
-CREATE INDEX PROJECTS_KEE ON PROJECTS (KEE);
-
-create table PROJECT_LINKS (
- ID INTEGER not null,
- PROJECT_ID INTEGER not null,
- LINK_TYPE VARCHAR(20),
- NAME VARCHAR(128),
- HREF VARCHAR(2048) not null,
- primary key (id)
-);
-
-create table PROJECT_MEASURES (
- ID INTEGER not null,
- VALUE DECIMAL(30, 20),
- METRIC_ID INTEGER not null,
- SNAPSHOT_ID INTEGER,
- RULE_ID INTEGER,
- RULES_CATEGORY_ID INTEGER,
- TEXT_VALUE VARCHAR(96),
- TENDENCY INTEGER,
- MEASURE_DATE TIMESTAMP,
- PROJECT_ID INTEGER,
- ALERT_STATUS VARCHAR(5),
- ALERT_TEXT VARCHAR(4000),
- URL VARCHAR(2000),
- DESCRIPTION VARCHAR(4000),
- RULE_PRIORITY INTEGER,
- CHARACTERISTIC_ID INTEGER,
- VARIATION_VALUE_1 DECIMAL(30, 20),
- VARIATION_VALUE_2 DECIMAL(30, 20),
- VARIATION_VALUE_3 DECIMAL(30, 20),
- VARIATION_VALUE_4 DECIMAL(30, 20),
- VARIATION_VALUE_5 DECIMAL(30, 20),
- primary key (id)
-);
-CREATE INDEX MEASURES_SID_METRIC ON PROJECT_MEASURES (SNAPSHOT_ID, METRIC_ID);
-
-create table PROPERTIES (
- ID INTEGER not null,
- PROP_KEY VARCHAR(512),
- RESOURCE_ID INTEGER,
- TEXT_VALUE CLOB,
- USER_ID INTEGER,
- primary key (id)
-);
-CREATE INDEX PROPERTIES_KEY ON PROPERTIES (PROP_KEY);
-
-create table QUALITY_MODELS (
- ID INTEGER not null,
- NAME VARCHAR(100),
- primary key (id)
-);
-
-create table RULES (
- ID INTEGER not null,
- NAME VARCHAR(192),
- PLUGIN_RULE_KEY VARCHAR(200) not null,
- PLUGIN_NAME VARCHAR(255) not null,
- DESCRIPTION CLOB,
- PRIORITY INTEGER,
- ENABLED SMALLINT,
- CARDINALITY VARCHAR(10),
- PARENT_ID INTEGER,
- PLUGIN_CONFIG_KEY VARCHAR(500),
- primary key (id)
-);
-
-create table RULES_CATEGORIES (
- ID INTEGER not null,
- NAME VARCHAR(255) not null,
- DESCRIPTION VARCHAR(1000) not null,
- primary key (id)
-);
-
-create table RULES_PARAMETERS (
- ID INTEGER not null,
- RULE_ID INTEGER not null,
- NAME VARCHAR(128) not null,
- PARAM_TYPE VARCHAR(512) not null,
- DEFAULT_VALUE VARCHAR(4000),
- DESCRIPTION VARCHAR(4000),
- primary key (id)
-);
-CREATE INDEX ALTERED_RULES_PARAMETERS_RULE_ID ON RULES_PARAMETERS (RULE_ID);
-
-create table RULES_PROFILES (
- ID INTEGER not null,
- NAME VARCHAR(100) not null,
- DEFAULT_PROFILE SMALLINT,
- PROVIDED SMALLINT,
- LANGUAGE VARCHAR(16),
- PARENT_NAME VARCHAR(100),
- ENABLED SMALLINT,
- VERSION INTEGER not null,
- USED_PROFILE SMALLINT not null,
- primary key (id)
-);
-
-create table RULE_FAILURES (
- ID INTEGER not null,
- SNAPSHOT_ID INTEGER not null,
- RULE_ID INTEGER not null,
- FAILURE_LEVEL INTEGER not null,
- MESSAGE VARCHAR(4000),
- LINE INTEGER,
- COST DECIMAL(30, 20),
- CREATED_AT TIMESTAMP,
- CHECKSUM VARCHAR(1000),
- PERMANENT_ID INTEGER,
- SWITCHED_OFF SMALLINT,
- primary key (id)
-);
-CREATE INDEX RF_PERMANENT_ID ON RULE_FAILURES (PERMANENT_ID);
-CREATE INDEX RULE_FAILURE_RULE_ID ON RULE_FAILURES (RULE_ID);
-CREATE INDEX RULE_FAILURE_SNAPSHOT_ID ON RULE_FAILURES (SNAPSHOT_ID);
-
-create table SCHEMA_MIGRATIONS (
- VERSION VARCHAR(256) not null
-);
-CREATE UNIQUE INDEX UNIQUE_SCHEMA_MIGRATIONS ON SCHEMA_MIGRATIONS (VERSION);
-
-create table SNAPSHOTS (
- ID INTEGER not null,
- CREATED_AT TIMESTAMP,
- PROJECT_ID INTEGER not null,
- PARENT_SNAPSHOT_ID INTEGER,
- STATUS VARCHAR(4) not null,
- ISLAST SMALLINT not null,
- SCOPE VARCHAR(3),
- QUALIFIER VARCHAR(3),
- ROOT_SNAPSHOT_ID INTEGER,
- VERSION VARCHAR(60),
- PATH VARCHAR(96),
- DEPTH INTEGER,
- ROOT_PROJECT_ID INTEGER,
- PERIOD1_MODE VARCHAR(100),
- PERIOD1_PARAM VARCHAR(100),
- PERIOD1_DATE TIMESTAMP,
- PERIOD2_MODE VARCHAR(100),
- PERIOD2_PARAM VARCHAR(100),
- PERIOD2_DATE TIMESTAMP,
- PERIOD3_MODE VARCHAR(100),
- PERIOD3_PARAM VARCHAR(100),
- PERIOD3_DATE TIMESTAMP,
- PERIOD4_MODE VARCHAR(100),
- PERIOD4_PARAM VARCHAR(100),
- PERIOD4_DATE TIMESTAMP,
- PERIOD5_MODE VARCHAR(100),
- PERIOD5_PARAM VARCHAR(100),
- PERIOD5_DATE TIMESTAMP,
- primary key (id)
-);
-CREATE INDEX SNAPSHOTS_PARENT ON SNAPSHOTS (PARENT_SNAPSHOT_ID);
-CREATE INDEX SNAPSHOTS_QUALIFIER ON SNAPSHOTS (QUALIFIER);
-CREATE INDEX SNAPSHOTS_ROOT ON SNAPSHOTS (ROOT_SNAPSHOT_ID);
-CREATE INDEX SNAPSHOT_PROJECT_ID ON SNAPSHOTS (PROJECT_ID);
-
-create table SNAPSHOT_SOURCES (
- ID INTEGER not null,
- SNAPSHOT_ID INTEGER not null,
- DATA CLOB,
- primary key (id)
-);
-CREATE INDEX SNAP_SOURCES_SNAPSHOT_ID ON SNAPSHOT_SOURCES (SNAPSHOT_ID);
-
-create table USERS (
- ID INTEGER not null,
- LOGIN VARCHAR(40),
- NAME VARCHAR(200),
- EMAIL VARCHAR(100),
- CRYPTED_PASSWORD VARCHAR(40),
- SALT VARCHAR(40),
- CREATED_AT TIMESTAMP,
- UPDATED_AT TIMESTAMP,
- REMEMBER_TOKEN VARCHAR(500),
- REMEMBER_TOKEN_EXPIRES_AT TIMESTAMP,
- primary key (id)
-);
-
-create table USER_ROLES (
- ID INTEGER not null,
- USER_ID INTEGER,
- RESOURCE_ID INTEGER,
- ROLE VARCHAR(64) not null,
- primary key (id)
-);
-CREATE INDEX USER_ROLES_RESOURCE ON USER_ROLES (RESOURCE_ID);
-CREATE INDEX USER_ROLES_USER ON USER_ROLES (USER_ID);
-
-create table WIDGETS (
- ID INTEGER not null,
- DASHBOARD_ID INTEGER not null,
- WIDGET_KEY VARCHAR(256) not null,
- NAME VARCHAR(256),
- DESCRIPTION VARCHAR(1000),
- COLUMN_INDEX INTEGER,
- ROW_INDEX INTEGER,
- CONFIGURED SMALLINT,
- CREATED_AT TIMESTAMP,
- UPDATED_AT TIMESTAMP,
- primary key (id)
-);
-CREATE INDEX WIDGETS_DASHBOARDS ON WIDGETS (DASHBOARD_ID);
-CREATE INDEX WIDGETS_WIDGETKEY ON WIDGETS (WIDGET_KEY);
-
-create table WIDGET_PROPERTIES (
- ID INTEGER not null,
- WIDGET_ID INTEGER not null,
- KEE VARCHAR(100),
- TEXT_VALUE VARCHAR(4000),
- VALUE_TYPE VARCHAR(20),
- primary key (id)
-);
-CREATE INDEX WIDGET_PROPERTIES_WIDGETS ON WIDGET_PROPERTIES (WIDGET_ID);
-
-CREATE TABLE REVIEWS (
- ID INTEGER NOT NULL,
- CREATED_AT TIMESTAMP,
- UPDATED_AT TIMESTAMP,
- USER_ID INTEGER,
- ASSIGNEE_ID INTEGER,
- TITLE VARCHAR(500),
- STATUS VARCHAR(10),
- SEVERITY VARCHAR(10),
- RULE_FAILURE_PERMANENT_ID INTEGER,
- PROJECT_ID INTEGER,
- RESOURCE_ID INTEGER,
- RESOURCE_LINE INTEGER,
- RESOLUTION VARCHAR(200),
- primary key (id)
-);
-
-CREATE TABLE REVIEW_COMMENTS (
- ID INTEGER NOT NULL,
- CREATED_AT TIMESTAMP,
- UPDATED_AT TIMESTAMP,
- REVIEW_ID INTEGER,
- USER_ID INTEGER,
- REVIEW_TEXT CLOB(2147483647),
- primary key (id)
-);
-
-CREATE TABLE CLONE_BLOCKS (
- PROJECT_SNAPSHOT_ID INTEGER,
- SNAPSHOT_ID INTEGER,
- HASH VARCHAR(50),
- INDEX_IN_FILE INTEGER NOT NULL,
- START_LINE INTEGER NOT NULL,
- END_LINE INTEGER NOT NULL
-);
-CREATE INDEX CLONE_BLOCKS_PROJECT_SNAPSHOT ON CLONE_BLOCKS (PROJECT_SNAPSHOT_ID);
-CREATE INDEX CLONE_BLOCKS_SNAPSHOT ON CLONE_BLOCKS (SNAPSHOT_ID);
-CREATE INDEX CLONE_BLOCKS_HASH ON CLONE_BLOCKS (HASH);