summaryrefslogtreecommitdiffstats
path: root/sonar-core/src
diff options
context:
space:
mode:
authorJean-Baptiste Lievremont <jean-baptiste.lievremont@sonarsource.com>2014-11-06 16:47:46 +0100
committerJean-Baptiste Lievremont <jean-baptiste.lievremont@sonarsource.com>2014-11-06 16:47:53 +0100
commit15c34a1fbcb4f42b45ba82ccb9090235c2bf7164 (patch)
treedd1acd78f8b77dd0795a686a66e1e7be0acce26a /sonar-core/src
parent1e92c1ccba98dd2b4cdda59b8fd5332022b69a79 (diff)
downloadsonarqube-15c34a1fbcb4f42b45ba82ccb9090235c2bf7164.tar.gz
sonarqube-15c34a1fbcb4f42b45ba82ccb9090235c2bf7164.zip
SONAR-5825 Create DB structure to store file oriented data
Diffstat (limited to 'sonar-core/src')
-rw-r--r--sonar-core/src/main/java/org/sonar/core/persistence/DatabaseVersion.java3
-rw-r--r--sonar-core/src/main/resources/org/sonar/core/persistence/rows-h2.sql1
-rw-r--r--sonar-core/src/main/resources/org/sonar/core/persistence/schema-h2.ddl16
3 files changed, 19 insertions, 1 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 93d65401b9e..970a1d1b2c1 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 = 712;
+ public static final int LAST_VERSION = 713;
/**
* List of all the tables.
* This list is hardcoded because we didn't succeed in using java.sql.DatabaseMetaData#getTables() in the same way
@@ -52,6 +52,7 @@ public class DatabaseVersion implements BatchComponent, ServerComponent {
"dependencies",
"duplications_index",
"events",
+ "file_sources",
"graphs",
"groups",
"groups_users",
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 b7118612b8a..2d0708f8199 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
@@ -272,6 +272,7 @@ INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('709');
INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('710');
INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('711');
INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('712');
+INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('713');
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 4db09659428..f579edcf5c2 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
@@ -566,6 +566,16 @@ CREATE TABLE "ANALYSIS_REPORTS" (
"FINISHED_AT" TIMESTAMP
);
+CREATE TABLE "FILE_SOURCES" (
+ "ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1),
+ "PROJECT_UUID" VARCHAR(50) NOT NULL,
+ "FILE_UUID" VARCHAR(50) NOT NULL,
+ "DATA" CLOB(2147483647),
+ "DATA_HASH" VARCHAR(50) NOT NULL,
+ "CREATED_AT" TIMESTAMP NOT NULL,
+ "UPDATED_AT" TIMESTAMP NOT NULL
+);
+
-- ----------------------------------------------
-- DDL Statements for indexes
-- ----------------------------------------------
@@ -707,3 +717,9 @@ CREATE UNIQUE INDEX "ACTIVE_RULES_UNIQUE" ON "ACTIVE_RULES" ("PROFILE_ID","RULE_
CREATE INDEX "SNAPSHOT_DATA_RESOURCE_IDS" ON "SNAPSHOT_DATA" ("RESOURCE_ID");
CREATE UNIQUE INDEX "PROFILE_UNIQUE_KEY" ON "RULES_PROFILES" ("KEE");
+
+CREATE INDEX "FILE_SOURCES_PROJECT_UUID" ON "FILE_SOURCES" ("PROJECT_UUID");
+
+CREATE INDEX "FILE_SOURCES_FILE_UUID" ON "FILE_SOURCES" ("FILE_UUID");
+
+CREATE INDEX "FILE_SOURCES_UPDATED_AT" ON "FILE_SOURCES" ("UPDATED_AT");