aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-db-core
diff options
context:
space:
mode:
authorSimon Brandhof <simon.brandhof@sonarsource.com>2017-09-11 11:42:40 +0200
committerJanos Gyerik <janos.gyerik@sonarsource.com>2017-09-12 10:52:52 +0200
commit65c4e90bb68f32a43cc192ed0878fcf942544b9f (patch)
treeeccc607e19323ce8d65a1e6b62c151a9be0755a8 /server/sonar-db-core
parent1a6b9d21db5154ccf5ce34d671f567138f497dbb (diff)
downloadsonarqube-65c4e90bb68f32a43cc192ed0878fcf942544b9f.tar.gz
sonarqube-65c4e90bb68f32a43cc192ed0878fcf942544b9f.zip
SONAR-9616 decrease coupling with component keys
Diffstat (limited to 'server/sonar-db-core')
-rw-r--r--server/sonar-db-core/src/main/java/org/sonar/db/version/SqTables.java14
-rw-r--r--server/sonar-db-core/src/main/resources/org/sonar/db/version/schema-h2.ddl15
2 files changed, 24 insertions, 5 deletions
diff --git a/server/sonar-db-core/src/main/java/org/sonar/db/version/SqTables.java b/server/sonar-db-core/src/main/java/org/sonar/db/version/SqTables.java
index 2f6d77bcb05..c92eb1734e0 100644
--- a/server/sonar-db-core/src/main/java/org/sonar/db/version/SqTables.java
+++ b/server/sonar-db-core/src/main/java/org/sonar/db/version/SqTables.java
@@ -19,16 +19,19 @@
*/
package org.sonar.db.version;
-import com.google.common.collect.ImmutableSet;
+import java.util.HashSet;
import java.util.Set;
+import static java.util.Arrays.asList;
+import static java.util.Collections.unmodifiableSet;
+
public final class SqTables {
/**
* These tables are still involved in DB migrations, so potentially
* incorrect collation must be fixed so that joins with other
* tables are possible.
*/
- public static final Set<String> OLD_DROPPED_TABLES = ImmutableSet.of(
+ public static final Set<String> OLD_DROPPED_TABLES = unmodifiableSet(new HashSet<>(asList(
"active_dashboards",
"activities",
"dashboards",
@@ -38,14 +41,14 @@ public final class SqTables {
"measure_filter_favourites",
"resource_index",
"widgets",
- "widget_properties");
+ "widget_properties")));
/**
* List of all the tables.
* This list is hardcoded because we didn't succeed in using java.sql.DatabaseMetaData#getTables() in the same way
* for all the supported databases, particularly due to Oracle results.
*/
- public static final Set<String> TABLES = ImmutableSet.of(
+ public static final Set<String> TABLES = unmodifiableSet(new HashSet<>(asList(
"active_rules",
"active_rule_parameters",
"ce_activity",
@@ -80,6 +83,7 @@ public final class SqTables {
"project_links",
"project_measures",
"project_qprofiles",
+ "project_branches",
"properties",
"qprofile_changes",
"quality_gates",
@@ -94,7 +98,7 @@ public final class SqTables {
"users",
"user_roles",
"user_tokens",
- "webhook_deliveries");
+ "webhook_deliveries")));
private SqTables() {
// prevents instantiation
diff --git a/server/sonar-db-core/src/main/resources/org/sonar/db/version/schema-h2.ddl b/server/sonar-db-core/src/main/resources/org/sonar/db/version/schema-h2.ddl
index 55bc327fb2a..7f5d6724427 100644
--- a/server/sonar-db-core/src/main/resources/org/sonar/db/version/schema-h2.ddl
+++ b/server/sonar-db-core/src/main/resources/org/sonar/db/version/schema-h2.ddl
@@ -306,6 +306,7 @@ CREATE TABLE "PROJECTS" (
"PROJECT_UUID" VARCHAR(50) NOT NULL,
"MODULE_UUID" VARCHAR(50),
"MODULE_UUID_PATH" VARCHAR(1500),
+ "MAIN_BRANCH_PROJECT_UUID" VARCHAR(50),
"NAME" VARCHAR(2000),
"DESCRIPTION" VARCHAR(2000),
"PRIVATE" BOOLEAN NOT NULL,
@@ -670,6 +671,7 @@ CREATE UNIQUE INDEX "PK_WEBHOOK_DELIVERIES" ON "WEBHOOK_DELIVERIES" ("UUID");
CREATE INDEX "COMPONENT_UUID" ON "WEBHOOK_DELIVERIES" ("COMPONENT_UUID");
CREATE INDEX "CE_TASK_UUID" ON "WEBHOOK_DELIVERIES" ("CE_TASK_UUID");
+
CREATE TABLE "ES_QUEUE" (
"UUID" VARCHAR(40) NOT NULL PRIMARY KEY,
"DOC_TYPE" VARCHAR(40) NOT NULL,
@@ -690,3 +692,16 @@ CREATE TABLE "PLUGINS" (
"UPDATED_AT" BIGINT NOT NULL
);
CREATE UNIQUE INDEX "PLUGINS_KEY" ON "PLUGINS" ("KEE");
+
+CREATE TABLE "PROJECT_BRANCHES" (
+ "UUID" VARCHAR(50) NOT NULL PRIMARY KEY,
+ "PROJECT_UUID" VARCHAR(50) NOT NULL,
+ "KEE_TYPE" VARCHAR(6) NOT NULL,
+ "KEE" VARCHAR(255) NOT NULL,
+ "BRANCH_TYPE" VARCHAR(5),
+ "MERGE_BRANCH_UUID" VARCHAR(50),
+ "PULL_REQUEST_TITLE" VARCHAR(4000),
+ "CREATED_AT" BIGINT NOT NULL
+);
+CREATE UNIQUE INDEX "PK_PROJECT_BRANCHES" ON "PROJECT_BRANCHES" ("UUID");
+CREATE UNIQUE INDEX "PROJECT_BRANCHES_KEE" ON "PROJECT_BRANCHES" ("PROJECT_UUID", "KEE_TYPE", "KEE");