]> source.dussan.org Git - sonarqube.git/blob
8afa160d62ed122293e900744c116bbcda9e50dd
[sonarqube.git] /
1 CREATE TABLE "COMPONENTS"(
2     "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1),
3     "UUID" VARCHAR(50) NOT NULL,
4     "ORGANIZATION_UUID" VARCHAR(40) NOT NULL,
5     "KEE" VARCHAR(400),
6     "DEPRECATED_KEE" VARCHAR(400),
7     "NAME" VARCHAR(2000),
8     "LONG_NAME" VARCHAR(2000),
9     "DESCRIPTION" VARCHAR(2000),
10     "ENABLED" BOOLEAN DEFAULT TRUE NOT NULL,
11     "SCOPE" VARCHAR(3),
12     "QUALIFIER" VARCHAR(10),
13     "PRIVATE" BOOLEAN NOT NULL,
14     "ROOT_UUID" VARCHAR(50) NOT NULL,
15     "LANGUAGE" VARCHAR(20),
16     "COPY_COMPONENT_UUID" VARCHAR(50),
17     "PATH" VARCHAR(2000),
18     "UUID_PATH" VARCHAR(1500) NOT NULL,
19     "PROJECT_UUID" VARCHAR(50) NOT NULL,
20     "MODULE_UUID" VARCHAR(50),
21     "MODULE_UUID_PATH" VARCHAR(1500),
22     "MAIN_BRANCH_PROJECT_UUID" VARCHAR(50),
23     "B_CHANGED" BOOLEAN,
24     "B_NAME" VARCHAR(500),
25     "B_LONG_NAME" VARCHAR(500),
26     "B_DESCRIPTION" VARCHAR(2000),
27     "B_ENABLED" BOOLEAN,
28     "B_QUALIFIER" VARCHAR(10),
29     "B_LANGUAGE" VARCHAR(20),
30     "B_COPY_COMPONENT_UUID" VARCHAR(50),
31     "B_PATH" VARCHAR(2000),
32     "B_UUID_PATH" VARCHAR(1500),
33     "B_MODULE_UUID" VARCHAR(50),
34     "B_MODULE_UUID_PATH" VARCHAR(1500),
35     "CREATED_AT" TIMESTAMP
36 );
37 ALTER TABLE "COMPONENTS" ADD CONSTRAINT "PK_PROJECTS" PRIMARY KEY("ID");
38 CREATE INDEX "PROJECTS_ORGANIZATION" ON "COMPONENTS"("ORGANIZATION_UUID");
39 CREATE UNIQUE INDEX "PROJECTS_KEE" ON "COMPONENTS"("KEE");
40 CREATE INDEX "PROJECTS_MODULE_UUID" ON "COMPONENTS"("MODULE_UUID");
41 CREATE INDEX "PROJECTS_PROJECT_UUID" ON "COMPONENTS"("PROJECT_UUID");
42 CREATE INDEX "PROJECTS_QUALIFIER" ON "COMPONENTS"("QUALIFIER");
43 CREATE INDEX "PROJECTS_ROOT_UUID" ON "COMPONENTS"("ROOT_UUID");
44 CREATE INDEX "PROJECTS_UUID" ON "COMPONENTS"("UUID");
45
46 CREATE TABLE "METRICS"(
47     "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1),
48     "NAME" VARCHAR(64) NOT NULL,
49     "DESCRIPTION" VARCHAR(255),
50     "DIRECTION" INTEGER DEFAULT 0 NOT NULL,
51     "DOMAIN" VARCHAR(64),
52     "SHORT_NAME" VARCHAR(64),
53     "QUALITATIVE" BOOLEAN DEFAULT FALSE NOT NULL,
54     "VAL_TYPE" VARCHAR(8),
55     "USER_MANAGED" BOOLEAN DEFAULT FALSE,
56     "ENABLED" BOOLEAN DEFAULT TRUE,
57     "WORST_VALUE" DOUBLE,
58     "BEST_VALUE" DOUBLE,
59     "OPTIMIZED_BEST_VALUE" BOOLEAN,
60     "HIDDEN" BOOLEAN,
61     "DELETE_HISTORICAL_DATA" BOOLEAN,
62     "DECIMAL_SCALE" INTEGER
63 );
64 ALTER TABLE "METRICS" ADD CONSTRAINT "PK_METRICS" PRIMARY KEY("ID");
65 CREATE UNIQUE INDEX "METRICS_UNIQUE_NAME" ON "METRICS"("NAME");
66
67 CREATE TABLE "LIVE_MEASURES"(
68     "UUID" VARCHAR(40) NOT NULL,
69     "PROJECT_UUID" VARCHAR(50) NOT NULL,
70     "COMPONENT_UUID" VARCHAR(50) NOT NULL,
71     "METRIC_ID" INTEGER NOT NULL,
72     "VALUE" DOUBLE,
73     "TEXT_VALUE" VARCHAR(4000),
74     "VARIATION" DOUBLE,
75     "MEASURE_DATA" BLOB,
76     "UPDATE_MARKER" VARCHAR(40),
77     "CREATED_AT" BIGINT NOT NULL,
78     "UPDATED_AT" BIGINT NOT NULL
79 );
80 ALTER TABLE "LIVE_MEASURES" ADD CONSTRAINT "PK_LIVE_MEASURES" PRIMARY KEY("UUID");
81 CREATE INDEX "LIVE_MEASURES_PROJECT" ON "LIVE_MEASURES"("PROJECT_UUID");
82 CREATE UNIQUE INDEX "LIVE_MEASURES_COMPONENT" ON "LIVE_MEASURES"("COMPONENT_UUID", "METRIC_ID");
83
84 CREATE TABLE "PROJECT_MEASURES"(
85     "ID" BIGINT NOT NULL AUTO_INCREMENT (1,1),
86     "VALUE" DOUBLE,
87     "METRIC_ID" INTEGER NOT NULL,
88     "ANALYSIS_UUID" VARCHAR(50) NOT NULL,
89     "COMPONENT_UUID" VARCHAR(50) NOT NULL,
90     "TEXT_VALUE" VARCHAR(4000),
91     "ALERT_STATUS" VARCHAR(5),
92     "ALERT_TEXT" VARCHAR(4000),
93     "DESCRIPTION" VARCHAR(4000),
94     "PERSON_ID" INTEGER,
95     "VARIATION_VALUE_1" DOUBLE,
96     "VARIATION_VALUE_2" DOUBLE,
97     "VARIATION_VALUE_3" DOUBLE,
98     "VARIATION_VALUE_4" DOUBLE,
99     "VARIATION_VALUE_5" DOUBLE,
100     "MEASURE_DATA" BLOB
101 );
102 ALTER TABLE "PROJECT_MEASURES" ADD CONSTRAINT "PK_PROJECT_MEASURES" PRIMARY KEY("ID");
103 CREATE INDEX "MEASURES_ANALYSIS_METRIC" ON "PROJECT_MEASURES"("ANALYSIS_UUID", "METRIC_ID");
104 CREATE INDEX "MEASURES_COMPONENT_UUID" ON "PROJECT_MEASURES"("COMPONENT_UUID");