diff options
author | Jacek <jacek.poreda@sonarsource.com> | 2021-12-17 10:07:10 +0100 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2022-02-02 20:02:54 +0000 |
commit | bf5f5f91ed7a6489fda3f6d4ee163ad94aaedcb6 (patch) | |
tree | bd3e7958534488ce2e8d02edb717fae8fb063402 | |
parent | da25d9b1d4a2459bb201dd9b6e8166bd55149c57 (diff) | |
download | sonarqube-bf5f5f91ed7a6489fda3f6d4ee163ad94aaedcb6.tar.gz sonarqube-bf5f5f91ed7a6489fda3f6d4ee163ad94aaedcb6.zip |
SONAR-15845 Upgrade H2 database dependency to 2.X
17 files changed, 573 insertions, 566 deletions
diff --git a/build.gradle b/build.gradle index 36d1474a37d..3eadda98b05 100644 --- a/build.gradle +++ b/build.gradle @@ -321,8 +321,7 @@ subprojects { exclude 'org.codehaus.mojo:animal-sniffer-annotations' } dependency "com.google.protobuf:protobuf-java:${protobufVersion}" - // Do not upgrade H2 to 1.4.200 because of instability: https://github.com/h2database/h2database/issues/2205 - dependency 'com.h2database:h2:1.4.199' + dependency 'com.h2database:h2:2.1.210' dependencySet(group: 'com.hazelcast', version: '4.2.2') { entry 'hazelcast' } diff --git a/server/sonar-db-core/src/main/java/org/sonar/db/DefaultDatabase.java b/server/sonar-db-core/src/main/java/org/sonar/db/DefaultDatabase.java index 1ea01fe5532..be9cd2b872c 100644 --- a/server/sonar-db-core/src/main/java/org/sonar/db/DefaultDatabase.java +++ b/server/sonar-db-core/src/main/java/org/sonar/db/DefaultDatabase.java @@ -49,10 +49,10 @@ import static org.sonar.process.ProcessProperties.Property.JDBC_URL; * @since 2.12 */ public class DefaultDatabase implements Database { - + private static final String IGNORED_KEYWORDS_OPTION = ";NON_KEYWORDS=VALUE"; private static final Logger LOG = Loggers.get(Database.class); - private static final String DEFAULT_URL = "jdbc:h2:tcp://localhost/sonar"; + private static final String DEFAULT_URL = "jdbc:h2:tcp://localhost/sonar" + IGNORED_KEYWORDS_OPTION; private static final String SONAR_JDBC = "sonar.jdbc."; private static final String SONAR_JDBC_DIALECT = "sonar.jdbc.dialect"; private static final String SONAR_JDBC_DRIVER = "sonar.jdbc.driverClassName"; diff --git a/server/sonar-db-core/src/test/java/org/sonar/db/DefaultDatabaseTest.java b/server/sonar-db-core/src/test/java/org/sonar/db/DefaultDatabaseTest.java index cfac879e089..67d05f4e1e8 100644 --- a/server/sonar-db-core/src/test/java/org/sonar/db/DefaultDatabaseTest.java +++ b/server/sonar-db-core/src/test/java/org/sonar/db/DefaultDatabaseTest.java @@ -48,9 +48,9 @@ public class DefaultDatabaseTest { db.initSettings(); Properties props = db.getProperties(); - assertThat(props.getProperty("sonar.jdbc.url")).isEqualTo("jdbc:h2:tcp://localhost/sonar"); + assertThat(props.getProperty("sonar.jdbc.url")).isEqualTo("jdbc:h2:tcp://localhost/sonar;NON_KEYWORDS=VALUE"); assertThat(props.getProperty("sonar.jdbc.driverClassName")).isEqualTo("org.h2.Driver"); - assertThat(db).hasToString("Database[jdbc:h2:tcp://localhost/sonar]"); + assertThat(db).hasToString("Database[jdbc:h2:tcp://localhost/sonar;NON_KEYWORDS=VALUE]"); } @Test @@ -113,7 +113,7 @@ public class DefaultDatabaseTest { @Test public void shouldStart() { MapSettings settings = new MapSettings(); - settings.setProperty("sonar.jdbc.url", "jdbc:h2:mem:sonar"); + settings.setProperty("sonar.jdbc.url", "jdbc:h2:mem:sonar;NON_KEYWORDS=VALUE"); settings.setProperty("sonar.jdbc.driverClassName", "org.h2.Driver"); settings.setProperty("sonar.jdbc.username", "sonar"); settings.setProperty("sonar.jdbc.password", "sonar"); diff --git a/server/sonar-db-core/src/testFixtures/java/org/sonar/db/CoreH2Database.java b/server/sonar-db-core/src/testFixtures/java/org/sonar/db/CoreH2Database.java index 524a9e39531..3a46a6b56e2 100644 --- a/server/sonar-db-core/src/testFixtures/java/org/sonar/db/CoreH2Database.java +++ b/server/sonar-db-core/src/testFixtures/java/org/sonar/db/CoreH2Database.java @@ -36,6 +36,7 @@ import static java.lang.String.format; * H2 in-memory database, used for unit tests only against an empty DB or a provided H2 SQL script. */ public class CoreH2Database implements Database { + private static final String IGNORED_KEYWORDS_OPTION = ";NON_KEYWORDS=VALUE"; private final String name; private BasicDataSource datasource; @@ -43,7 +44,7 @@ public class CoreH2Database implements Database { * IMPORTANT: change DB name in order to not conflict with {@link DefaultDatabaseTest} */ public CoreH2Database(String name) { - this.name = name; + this.name = name + IGNORED_KEYWORDS_OPTION; } @Override diff --git a/server/sonar-db-core/src/testFixtures/java/org/sonar/db/CoreTestDb.java b/server/sonar-db-core/src/testFixtures/java/org/sonar/db/CoreTestDb.java index 7704aa89e98..789b7003326 100644 --- a/server/sonar-db-core/src/testFixtures/java/org/sonar/db/CoreTestDb.java +++ b/server/sonar-db-core/src/testFixtures/java/org/sonar/db/CoreTestDb.java @@ -91,6 +91,7 @@ class CoreTestDb implements TestDb { if (!databaseToUpper) { name = name + ";DATABASE_TO_UPPER=FALSE"; } + name = name + ";NON_KEYWORDS=VALUE"; return new CoreH2Database(name); }; Consumer<Database> databaseInitializer = database -> { diff --git a/server/sonar-db-dao/src/schema/schema-sq.ddl b/server/sonar-db-dao/src/schema/schema-sq.ddl index d2c2746bd79..cea68962a96 100644 --- a/server/sonar-db-dao/src/schema/schema-sq.ddl +++ b/server/sonar-db-dao/src/schema/schema-sq.ddl @@ -10,800 +10,800 @@ ############################################################### CREATE TABLE "SCHEMA_MIGRATIONS"( - "VERSION" VARCHAR(255) NOT NULL + "VERSION" CHARACTER VARYING(255) NOT NULL ); CREATE TABLE "ACTIVE_RULE_PARAMETERS"( - "UUID" VARCHAR(40) NOT NULL, - "VALUE" VARCHAR(4000), - "RULES_PARAMETER_KEY" VARCHAR(128), - "ACTIVE_RULE_UUID" VARCHAR(40) NOT NULL, - "RULES_PARAMETER_UUID" VARCHAR(40) NOT NULL + "UUID" CHARACTER VARYING(40) NOT NULL, + "VALUE" CHARACTER VARYING(4000), + "RULES_PARAMETER_KEY" CHARACTER VARYING(128), + "ACTIVE_RULE_UUID" CHARACTER VARYING(40) NOT NULL, + "RULES_PARAMETER_UUID" CHARACTER VARYING(40) NOT NULL ); ALTER TABLE "ACTIVE_RULE_PARAMETERS" ADD CONSTRAINT "PK_ACTIVE_RULE_PARAMETERS" PRIMARY KEY("UUID"); -CREATE INDEX "ARP_ACTIVE_RULE_UUID" ON "ACTIVE_RULE_PARAMETERS"("ACTIVE_RULE_UUID"); +CREATE INDEX "ARP_ACTIVE_RULE_UUID" ON "ACTIVE_RULE_PARAMETERS"("ACTIVE_RULE_UUID" NULLS FIRST); CREATE TABLE "ACTIVE_RULES"( - "UUID" VARCHAR(40) NOT NULL, + "UUID" CHARACTER VARYING(40) NOT NULL, "FAILURE_LEVEL" INTEGER NOT NULL, - "INHERITANCE" VARCHAR(10), + "INHERITANCE" CHARACTER VARYING(10), "CREATED_AT" BIGINT, "UPDATED_AT" BIGINT, - "PROFILE_UUID" VARCHAR(40) NOT NULL, - "RULE_UUID" VARCHAR(40) NOT NULL + "PROFILE_UUID" CHARACTER VARYING(40) NOT NULL, + "RULE_UUID" CHARACTER VARYING(40) NOT NULL ); ALTER TABLE "ACTIVE_RULES" ADD CONSTRAINT "PK_ACTIVE_RULES" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "UNIQ_PROFILE_RULE_UUIDS" ON "ACTIVE_RULES"("PROFILE_UUID", "RULE_UUID"); +CREATE UNIQUE INDEX "UNIQ_PROFILE_RULE_UUIDS" ON "ACTIVE_RULES"("PROFILE_UUID" NULLS FIRST, "RULE_UUID" NULLS FIRST); CREATE TABLE "ALM_PATS"( - "UUID" VARCHAR(40) NOT NULL, - "PAT" VARCHAR(2000) NOT NULL, - "USER_UUID" VARCHAR(256) NOT NULL, - "ALM_SETTING_UUID" VARCHAR(40) NOT NULL, + "UUID" CHARACTER VARYING(40) NOT NULL, + "PAT" CHARACTER VARYING(2000) NOT NULL, + "USER_UUID" CHARACTER VARYING(256) NOT NULL, + "ALM_SETTING_UUID" CHARACTER VARYING(40) NOT NULL, "UPDATED_AT" BIGINT NOT NULL, "CREATED_AT" BIGINT NOT NULL ); ALTER TABLE "ALM_PATS" ADD CONSTRAINT "PK_ALM_PATS" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "UNIQ_ALM_PATS" ON "ALM_PATS"("USER_UUID", "ALM_SETTING_UUID"); +CREATE UNIQUE INDEX "UNIQ_ALM_PATS" ON "ALM_PATS"("USER_UUID" NULLS FIRST, "ALM_SETTING_UUID" NULLS FIRST); CREATE TABLE "ALM_SETTINGS"( - "UUID" VARCHAR(40) NOT NULL, - "ALM_ID" VARCHAR(40) NOT NULL, - "KEE" VARCHAR(200) NOT NULL, - "URL" VARCHAR(2000), - "APP_ID" VARCHAR(80), - "PRIVATE_KEY" VARCHAR(2500), - "PAT" VARCHAR(2000), + "UUID" CHARACTER VARYING(40) NOT NULL, + "ALM_ID" CHARACTER VARYING(40) NOT NULL, + "KEE" CHARACTER VARYING(200) NOT NULL, + "URL" CHARACTER VARYING(2000), + "APP_ID" CHARACTER VARYING(80), + "PRIVATE_KEY" CHARACTER VARYING(2500), + "PAT" CHARACTER VARYING(2000), "UPDATED_AT" BIGINT NOT NULL, "CREATED_AT" BIGINT NOT NULL, - "CLIENT_ID" VARCHAR(80), - "CLIENT_SECRET" VARCHAR(160) + "CLIENT_ID" CHARACTER VARYING(80), + "CLIENT_SECRET" CHARACTER VARYING(160) ); ALTER TABLE "ALM_SETTINGS" ADD CONSTRAINT "PK_ALM_SETTINGS" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "UNIQ_ALM_SETTINGS" ON "ALM_SETTINGS"("KEE"); +CREATE UNIQUE INDEX "UNIQ_ALM_SETTINGS" ON "ALM_SETTINGS"("KEE" NULLS FIRST); CREATE TABLE "ANALYSIS_PROPERTIES"( - "UUID" VARCHAR(40) NOT NULL, - "ANALYSIS_UUID" VARCHAR(40) NOT NULL, - "KEE" VARCHAR(512) NOT NULL, - "TEXT_VALUE" VARCHAR(4000), - "CLOB_VALUE" CLOB, + "UUID" CHARACTER VARYING(40) NOT NULL, + "ANALYSIS_UUID" CHARACTER VARYING(40) NOT NULL, + "KEE" CHARACTER VARYING(512) NOT NULL, + "TEXT_VALUE" CHARACTER VARYING(4000), + "CLOB_VALUE" CHARACTER LARGE OBJECT, "IS_EMPTY" BOOLEAN NOT NULL, "CREATED_AT" BIGINT NOT NULL ); ALTER TABLE "ANALYSIS_PROPERTIES" ADD CONSTRAINT "PK_ANALYSIS_PROPERTIES" PRIMARY KEY("UUID"); -CREATE INDEX "ANALYSIS_PROPERTIES_ANALYSIS" ON "ANALYSIS_PROPERTIES"("ANALYSIS_UUID"); +CREATE INDEX "ANALYSIS_PROPERTIES_ANALYSIS" ON "ANALYSIS_PROPERTIES"("ANALYSIS_UUID" NULLS FIRST); CREATE TABLE "APP_BRANCH_PROJECT_BRANCH"( - "UUID" VARCHAR(40) NOT NULL, - "APPLICATION_UUID" VARCHAR(40) NOT NULL, - "APPLICATION_BRANCH_UUID" VARCHAR(40) NOT NULL, - "PROJECT_UUID" VARCHAR(40) NOT NULL, - "PROJECT_BRANCH_UUID" VARCHAR(40) NOT NULL, + "UUID" CHARACTER VARYING(40) NOT NULL, + "APPLICATION_UUID" CHARACTER VARYING(40) NOT NULL, + "APPLICATION_BRANCH_UUID" CHARACTER VARYING(40) NOT NULL, + "PROJECT_UUID" CHARACTER VARYING(40) NOT NULL, + "PROJECT_BRANCH_UUID" CHARACTER VARYING(40) NOT NULL, "CREATED_AT" BIGINT NOT NULL ); ALTER TABLE "APP_BRANCH_PROJECT_BRANCH" ADD CONSTRAINT "PK_APP_BRANCH_PROJECT_BRANCH" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "UNIQ_APP_BRANCH_PROJ" ON "APP_BRANCH_PROJECT_BRANCH"("APPLICATION_BRANCH_UUID", "PROJECT_BRANCH_UUID"); -CREATE INDEX "IDX_ABPB_APP_UUID" ON "APP_BRANCH_PROJECT_BRANCH"("APPLICATION_UUID"); -CREATE INDEX "IDX_ABPB_APP_BRANCH_UUID" ON "APP_BRANCH_PROJECT_BRANCH"("APPLICATION_BRANCH_UUID"); -CREATE INDEX "IDX_ABPB_PROJ_UUID" ON "APP_BRANCH_PROJECT_BRANCH"("PROJECT_UUID"); -CREATE INDEX "IDX_ABPB_PROJ_BRANCH_UUID" ON "APP_BRANCH_PROJECT_BRANCH"("PROJECT_BRANCH_UUID"); +CREATE UNIQUE INDEX "UNIQ_APP_BRANCH_PROJ" ON "APP_BRANCH_PROJECT_BRANCH"("APPLICATION_BRANCH_UUID" NULLS FIRST, "PROJECT_BRANCH_UUID" NULLS FIRST); +CREATE INDEX "IDX_ABPB_APP_UUID" ON "APP_BRANCH_PROJECT_BRANCH"("APPLICATION_UUID" NULLS FIRST); +CREATE INDEX "IDX_ABPB_APP_BRANCH_UUID" ON "APP_BRANCH_PROJECT_BRANCH"("APPLICATION_BRANCH_UUID" NULLS FIRST); +CREATE INDEX "IDX_ABPB_PROJ_UUID" ON "APP_BRANCH_PROJECT_BRANCH"("PROJECT_UUID" NULLS FIRST); +CREATE INDEX "IDX_ABPB_PROJ_BRANCH_UUID" ON "APP_BRANCH_PROJECT_BRANCH"("PROJECT_BRANCH_UUID" NULLS FIRST); CREATE TABLE "APP_PROJECTS"( - "UUID" VARCHAR(40) NOT NULL, - "APPLICATION_UUID" VARCHAR(40) NOT NULL, - "PROJECT_UUID" VARCHAR(40) NOT NULL, + "UUID" CHARACTER VARYING(40) NOT NULL, + "APPLICATION_UUID" CHARACTER VARYING(40) NOT NULL, + "PROJECT_UUID" CHARACTER VARYING(40) NOT NULL, "CREATED_AT" BIGINT NOT NULL ); ALTER TABLE "APP_PROJECTS" ADD CONSTRAINT "PK_APP_PROJECTS" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "UNIQ_APP_PROJECTS" ON "APP_PROJECTS"("APPLICATION_UUID", "PROJECT_UUID"); -CREATE INDEX "IDX_APP_PROJ_APPLICATION_UUID" ON "APP_PROJECTS"("APPLICATION_UUID"); -CREATE INDEX "IDX_APP_PROJ_PROJECT_UUID" ON "APP_PROJECTS"("PROJECT_UUID"); +CREATE UNIQUE INDEX "UNIQ_APP_PROJECTS" ON "APP_PROJECTS"("APPLICATION_UUID" NULLS FIRST, "PROJECT_UUID" NULLS FIRST); +CREATE INDEX "IDX_APP_PROJ_APPLICATION_UUID" ON "APP_PROJECTS"("APPLICATION_UUID" NULLS FIRST); +CREATE INDEX "IDX_APP_PROJ_PROJECT_UUID" ON "APP_PROJECTS"("PROJECT_UUID" NULLS FIRST); CREATE TABLE "AUDITS"( - "UUID" VARCHAR(40) NOT NULL, - "USER_UUID" VARCHAR(40) NOT NULL, - "USER_LOGIN" VARCHAR(255) NOT NULL, - "CATEGORY" VARCHAR(25) NOT NULL, - "OPERATION" VARCHAR(50) NOT NULL, - "NEW_VALUE" VARCHAR(4000), + "UUID" CHARACTER VARYING(40) NOT NULL, + "USER_UUID" CHARACTER VARYING(40) NOT NULL, + "USER_LOGIN" CHARACTER VARYING(255) NOT NULL, + "CATEGORY" CHARACTER VARYING(25) NOT NULL, + "OPERATION" CHARACTER VARYING(50) NOT NULL, + "NEW_VALUE" CHARACTER VARYING(4000), "CREATED_AT" BIGINT NOT NULL ); ALTER TABLE "AUDITS" ADD CONSTRAINT "PK_AUDITS" PRIMARY KEY("UUID"); -CREATE INDEX "AUDITS_CREATED_AT" ON "AUDITS"("CREATED_AT"); +CREATE INDEX "AUDITS_CREATED_AT" ON "AUDITS"("CREATED_AT" NULLS FIRST); CREATE TABLE "CE_ACTIVITY"( - "UUID" VARCHAR(40) NOT NULL, - "TASK_TYPE" VARCHAR(15) NOT NULL, - "MAIN_COMPONENT_UUID" VARCHAR(40), - "COMPONENT_UUID" VARCHAR(40), - "STATUS" VARCHAR(15) NOT NULL, + "UUID" CHARACTER VARYING(40) NOT NULL, + "TASK_TYPE" CHARACTER VARYING(15) NOT NULL, + "MAIN_COMPONENT_UUID" CHARACTER VARYING(40), + "COMPONENT_UUID" CHARACTER VARYING(40), + "STATUS" CHARACTER VARYING(15) NOT NULL, "MAIN_IS_LAST" BOOLEAN NOT NULL, - "MAIN_IS_LAST_KEY" VARCHAR(55) NOT NULL, + "MAIN_IS_LAST_KEY" CHARACTER VARYING(55) NOT NULL, "IS_LAST" BOOLEAN NOT NULL, - "IS_LAST_KEY" VARCHAR(55) NOT NULL, - "SUBMITTER_UUID" VARCHAR(255), + "IS_LAST_KEY" CHARACTER VARYING(55) NOT NULL, + "SUBMITTER_UUID" CHARACTER VARYING(255), "SUBMITTED_AT" BIGINT NOT NULL, "STARTED_AT" BIGINT, "EXECUTED_AT" BIGINT, "EXECUTION_COUNT" INTEGER NOT NULL, "EXECUTION_TIME_MS" BIGINT, - "ANALYSIS_UUID" VARCHAR(50), - "ERROR_MESSAGE" VARCHAR(1000), - "ERROR_STACKTRACE" CLOB, - "ERROR_TYPE" VARCHAR(20), - "WORKER_UUID" VARCHAR(40), + "ANALYSIS_UUID" CHARACTER VARYING(50), + "ERROR_MESSAGE" CHARACTER VARYING(1000), + "ERROR_STACKTRACE" CHARACTER LARGE OBJECT, + "ERROR_TYPE" CHARACTER VARYING(20), + "WORKER_UUID" CHARACTER VARYING(40), "CREATED_AT" BIGINT NOT NULL, "UPDATED_AT" BIGINT NOT NULL ); ALTER TABLE "CE_ACTIVITY" ADD CONSTRAINT "PK_CE_ACTIVITY" PRIMARY KEY("UUID"); -CREATE INDEX "CE_ACTIVITY_COMPONENT" ON "CE_ACTIVITY"("COMPONENT_UUID"); -CREATE INDEX "CE_ACTIVITY_ISLAST" ON "CE_ACTIVITY"("IS_LAST", "STATUS"); -CREATE INDEX "CE_ACTIVITY_ISLAST_KEY" ON "CE_ACTIVITY"("IS_LAST_KEY"); -CREATE INDEX "CE_ACTIVITY_MAIN_COMPONENT" ON "CE_ACTIVITY"("MAIN_COMPONENT_UUID"); -CREATE INDEX "CE_ACTIVITY_MAIN_ISLAST" ON "CE_ACTIVITY"("MAIN_IS_LAST", "STATUS"); -CREATE INDEX "CE_ACTIVITY_MAIN_ISLAST_KEY" ON "CE_ACTIVITY"("MAIN_IS_LAST_KEY"); +CREATE INDEX "CE_ACTIVITY_COMPONENT" ON "CE_ACTIVITY"("COMPONENT_UUID" NULLS FIRST); +CREATE INDEX "CE_ACTIVITY_ISLAST" ON "CE_ACTIVITY"("IS_LAST" NULLS FIRST, "STATUS" NULLS FIRST); +CREATE INDEX "CE_ACTIVITY_ISLAST_KEY" ON "CE_ACTIVITY"("IS_LAST_KEY" NULLS FIRST); +CREATE INDEX "CE_ACTIVITY_MAIN_COMPONENT" ON "CE_ACTIVITY"("MAIN_COMPONENT_UUID" NULLS FIRST); +CREATE INDEX "CE_ACTIVITY_MAIN_ISLAST" ON "CE_ACTIVITY"("MAIN_IS_LAST" NULLS FIRST, "STATUS" NULLS FIRST); +CREATE INDEX "CE_ACTIVITY_MAIN_ISLAST_KEY" ON "CE_ACTIVITY"("MAIN_IS_LAST_KEY" NULLS FIRST); CREATE TABLE "CE_QUEUE"( - "UUID" VARCHAR(40) NOT NULL, - "TASK_TYPE" VARCHAR(15) NOT NULL, - "MAIN_COMPONENT_UUID" VARCHAR(40), - "COMPONENT_UUID" VARCHAR(40), - "STATUS" VARCHAR(15), - "SUBMITTER_UUID" VARCHAR(255), + "UUID" CHARACTER VARYING(40) NOT NULL, + "TASK_TYPE" CHARACTER VARYING(15) NOT NULL, + "MAIN_COMPONENT_UUID" CHARACTER VARYING(40), + "COMPONENT_UUID" CHARACTER VARYING(40), + "STATUS" CHARACTER VARYING(15), + "SUBMITTER_UUID" CHARACTER VARYING(255), "STARTED_AT" BIGINT, - "WORKER_UUID" VARCHAR(40), + "WORKER_UUID" CHARACTER VARYING(40), "EXECUTION_COUNT" INTEGER NOT NULL, "CREATED_AT" BIGINT NOT NULL, "UPDATED_AT" BIGINT NOT NULL ); ALTER TABLE "CE_QUEUE" ADD CONSTRAINT "PK_CE_QUEUE" PRIMARY KEY("UUID"); -CREATE INDEX "CE_QUEUE_MAIN_COMPONENT" ON "CE_QUEUE"("MAIN_COMPONENT_UUID"); -CREATE INDEX "CE_QUEUE_COMPONENT" ON "CE_QUEUE"("COMPONENT_UUID"); +CREATE INDEX "CE_QUEUE_MAIN_COMPONENT" ON "CE_QUEUE"("MAIN_COMPONENT_UUID" NULLS FIRST); +CREATE INDEX "CE_QUEUE_COMPONENT" ON "CE_QUEUE"("COMPONENT_UUID" NULLS FIRST); CREATE TABLE "CE_SCANNER_CONTEXT"( - "TASK_UUID" VARCHAR(40) NOT NULL, - "CONTEXT_DATA" BLOB NOT NULL, + "TASK_UUID" CHARACTER VARYING(40) NOT NULL, + "CONTEXT_DATA" BINARY LARGE OBJECT NOT NULL, "CREATED_AT" BIGINT NOT NULL, "UPDATED_AT" BIGINT NOT NULL ); ALTER TABLE "CE_SCANNER_CONTEXT" ADD CONSTRAINT "PK_CE_SCANNER_CONTEXT" PRIMARY KEY("TASK_UUID"); CREATE TABLE "CE_TASK_CHARACTERISTICS"( - "UUID" VARCHAR(40) NOT NULL, - "TASK_UUID" VARCHAR(40) NOT NULL, - "KEE" VARCHAR(512) NOT NULL, - "TEXT_VALUE" VARCHAR(512) + "UUID" CHARACTER VARYING(40) NOT NULL, + "TASK_UUID" CHARACTER VARYING(40) NOT NULL, + "KEE" CHARACTER VARYING(512) NOT NULL, + "TEXT_VALUE" CHARACTER VARYING(512) ); ALTER TABLE "CE_TASK_CHARACTERISTICS" ADD CONSTRAINT "PK_CE_TASK_CHARACTERISTICS" PRIMARY KEY("UUID"); -CREATE INDEX "CE_CHARACTERISTICS_TASK_UUID" ON "CE_TASK_CHARACTERISTICS"("TASK_UUID"); +CREATE INDEX "CE_CHARACTERISTICS_TASK_UUID" ON "CE_TASK_CHARACTERISTICS"("TASK_UUID" NULLS FIRST); CREATE TABLE "CE_TASK_INPUT"( - "TASK_UUID" VARCHAR(40) NOT NULL, - "INPUT_DATA" BLOB, + "TASK_UUID" CHARACTER VARYING(40) NOT NULL, + "INPUT_DATA" BINARY LARGE OBJECT, "CREATED_AT" BIGINT NOT NULL, "UPDATED_AT" BIGINT NOT NULL ); ALTER TABLE "CE_TASK_INPUT" ADD CONSTRAINT "PK_CE_TASK_INPUT" PRIMARY KEY("TASK_UUID"); CREATE TABLE "CE_TASK_MESSAGE"( - "UUID" VARCHAR(40) NOT NULL, - "TASK_UUID" VARCHAR(40) NOT NULL, - "MESSAGE" VARCHAR(4000) NOT NULL, + "UUID" CHARACTER VARYING(40) NOT NULL, + "TASK_UUID" CHARACTER VARYING(40) NOT NULL, + "MESSAGE" CHARACTER VARYING(4000) NOT NULL, "CREATED_AT" BIGINT NOT NULL, - "MESSAGE_TYPE" VARCHAR(255) NOT NULL + "MESSAGE_TYPE" CHARACTER VARYING(255) NOT NULL ); ALTER TABLE "CE_TASK_MESSAGE" ADD CONSTRAINT "PK_CE_TASK_MESSAGE" PRIMARY KEY("UUID"); -CREATE INDEX "CE_TASK_MESSAGE_TASK" ON "CE_TASK_MESSAGE"("TASK_UUID"); -CREATE INDEX "CTM_MESSAGE_TYPE" ON "CE_TASK_MESSAGE"("MESSAGE_TYPE"); +CREATE INDEX "CE_TASK_MESSAGE_TASK" ON "CE_TASK_MESSAGE"("TASK_UUID" NULLS FIRST); +CREATE INDEX "CTM_MESSAGE_TYPE" ON "CE_TASK_MESSAGE"("MESSAGE_TYPE" NULLS FIRST); CREATE TABLE "COMPONENTS"( - "UUID" VARCHAR(50) NOT NULL, - "KEE" VARCHAR(1000), - "DEPRECATED_KEE" VARCHAR(400), - "NAME" VARCHAR(2000), - "LONG_NAME" VARCHAR(2000), - "DESCRIPTION" VARCHAR(2000), + "UUID" CHARACTER VARYING(50) NOT NULL, + "KEE" CHARACTER VARYING(1000), + "DEPRECATED_KEE" CHARACTER VARYING(400), + "NAME" CHARACTER VARYING(2000), + "LONG_NAME" CHARACTER VARYING(2000), + "DESCRIPTION" CHARACTER VARYING(2000), "ENABLED" BOOLEAN DEFAULT TRUE NOT NULL, - "SCOPE" VARCHAR(3), - "QUALIFIER" VARCHAR(10), + "SCOPE" CHARACTER VARYING(3), + "QUALIFIER" CHARACTER VARYING(10), "PRIVATE" BOOLEAN NOT NULL, - "ROOT_UUID" VARCHAR(50) NOT NULL, - "LANGUAGE" VARCHAR(20), - "COPY_COMPONENT_UUID" VARCHAR(50), - "PATH" VARCHAR(2000), - "UUID_PATH" VARCHAR(1500) NOT NULL, - "PROJECT_UUID" VARCHAR(50) NOT NULL, - "MODULE_UUID" VARCHAR(50), - "MODULE_UUID_PATH" VARCHAR(1500), - "MAIN_BRANCH_PROJECT_UUID" VARCHAR(50), + "ROOT_UUID" CHARACTER VARYING(50) NOT NULL, + "LANGUAGE" CHARACTER VARYING(20), + "COPY_COMPONENT_UUID" CHARACTER VARYING(50), + "PATH" CHARACTER VARYING(2000), + "UUID_PATH" CHARACTER VARYING(1500) NOT NULL, + "PROJECT_UUID" CHARACTER VARYING(50) NOT NULL, + "MODULE_UUID" CHARACTER VARYING(50), + "MODULE_UUID_PATH" CHARACTER VARYING(1500), + "MAIN_BRANCH_PROJECT_UUID" CHARACTER VARYING(50), "B_CHANGED" BOOLEAN, - "B_NAME" VARCHAR(500), - "B_LONG_NAME" VARCHAR(500), - "B_DESCRIPTION" VARCHAR(2000), + "B_NAME" CHARACTER VARYING(500), + "B_LONG_NAME" CHARACTER VARYING(500), + "B_DESCRIPTION" CHARACTER VARYING(2000), "B_ENABLED" BOOLEAN, - "B_QUALIFIER" VARCHAR(10), - "B_LANGUAGE" VARCHAR(20), - "B_COPY_COMPONENT_UUID" VARCHAR(50), - "B_PATH" VARCHAR(2000), - "B_UUID_PATH" VARCHAR(1500), - "B_MODULE_UUID" VARCHAR(50), - "B_MODULE_UUID_PATH" VARCHAR(1500), + "B_QUALIFIER" CHARACTER VARYING(10), + "B_LANGUAGE" CHARACTER VARYING(20), + "B_COPY_COMPONENT_UUID" CHARACTER VARYING(50), + "B_PATH" CHARACTER VARYING(2000), + "B_UUID_PATH" CHARACTER VARYING(1500), + "B_MODULE_UUID" CHARACTER VARYING(50), + "B_MODULE_UUID_PATH" CHARACTER VARYING(1500), "CREATED_AT" TIMESTAMP ); -CREATE UNIQUE INDEX "PROJECTS_KEE" ON "COMPONENTS"("KEE"); -CREATE INDEX "PROJECTS_MODULE_UUID" ON "COMPONENTS"("MODULE_UUID"); -CREATE INDEX "PROJECTS_PROJECT_UUID" ON "COMPONENTS"("PROJECT_UUID"); -CREATE INDEX "PROJECTS_QUALIFIER" ON "COMPONENTS"("QUALIFIER"); -CREATE INDEX "PROJECTS_ROOT_UUID" ON "COMPONENTS"("ROOT_UUID"); -CREATE INDEX "PROJECTS_UUID" ON "COMPONENTS"("UUID"); -CREATE INDEX "IDX_MAIN_BRANCH_PRJ_UUID" ON "COMPONENTS"("MAIN_BRANCH_PROJECT_UUID"); +CREATE UNIQUE INDEX "PROJECTS_KEE" ON "COMPONENTS"("KEE" NULLS FIRST); +CREATE INDEX "PROJECTS_MODULE_UUID" ON "COMPONENTS"("MODULE_UUID" NULLS FIRST); +CREATE INDEX "PROJECTS_PROJECT_UUID" ON "COMPONENTS"("PROJECT_UUID" NULLS FIRST); +CREATE INDEX "PROJECTS_QUALIFIER" ON "COMPONENTS"("QUALIFIER" NULLS FIRST); +CREATE INDEX "PROJECTS_ROOT_UUID" ON "COMPONENTS"("ROOT_UUID" NULLS FIRST); +CREATE INDEX "PROJECTS_UUID" ON "COMPONENTS"("UUID" NULLS FIRST); +CREATE INDEX "IDX_MAIN_BRANCH_PRJ_UUID" ON "COMPONENTS"("MAIN_BRANCH_PROJECT_UUID" NULLS FIRST); CREATE TABLE "DEFAULT_QPROFILES"( - "LANGUAGE" VARCHAR(20) NOT NULL, - "QPROFILE_UUID" VARCHAR(255) NOT NULL, + "LANGUAGE" CHARACTER VARYING(20) NOT NULL, + "QPROFILE_UUID" CHARACTER VARYING(255) NOT NULL, "CREATED_AT" BIGINT NOT NULL, "UPDATED_AT" BIGINT NOT NULL ); ALTER TABLE "DEFAULT_QPROFILES" ADD CONSTRAINT "PK_DEFAULT_QPROFILES" PRIMARY KEY("LANGUAGE"); -CREATE UNIQUE INDEX "UNIQ_DEFAULT_QPROFILES_UUID" ON "DEFAULT_QPROFILES"("QPROFILE_UUID"); +CREATE UNIQUE INDEX "UNIQ_DEFAULT_QPROFILES_UUID" ON "DEFAULT_QPROFILES"("QPROFILE_UUID" NULLS FIRST); CREATE TABLE "DEPRECATED_RULE_KEYS"( - "UUID" VARCHAR(40) NOT NULL, - "OLD_REPOSITORY_KEY" VARCHAR(255) NOT NULL, - "OLD_RULE_KEY" VARCHAR(200) NOT NULL, + "UUID" CHARACTER VARYING(40) NOT NULL, + "OLD_REPOSITORY_KEY" CHARACTER VARYING(255) NOT NULL, + "OLD_RULE_KEY" CHARACTER VARYING(200) NOT NULL, "CREATED_AT" BIGINT NOT NULL, - "RULE_UUID" VARCHAR(40) NOT NULL + "RULE_UUID" CHARACTER VARYING(40) NOT NULL ); ALTER TABLE "DEPRECATED_RULE_KEYS" ADD CONSTRAINT "PK_DEPRECATED_RULE_KEYS" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "UNIQ_DEPRECATED_RULE_KEYS" ON "DEPRECATED_RULE_KEYS"("OLD_REPOSITORY_KEY", "OLD_RULE_KEY"); -CREATE INDEX "RULE_UUID_DEPRECATED_RULE_KEYS" ON "DEPRECATED_RULE_KEYS"("RULE_UUID"); +CREATE UNIQUE INDEX "UNIQ_DEPRECATED_RULE_KEYS" ON "DEPRECATED_RULE_KEYS"("OLD_REPOSITORY_KEY" NULLS FIRST, "OLD_RULE_KEY" NULLS FIRST); +CREATE INDEX "RULE_UUID_DEPRECATED_RULE_KEYS" ON "DEPRECATED_RULE_KEYS"("RULE_UUID" NULLS FIRST); CREATE TABLE "DUPLICATIONS_INDEX"( - "UUID" VARCHAR(40) NOT NULL, - "ANALYSIS_UUID" VARCHAR(50) NOT NULL, - "COMPONENT_UUID" VARCHAR(50) NOT NULL, - "HASH" VARCHAR(50) NOT NULL, + "UUID" CHARACTER VARYING(40) NOT NULL, + "ANALYSIS_UUID" CHARACTER VARYING(50) NOT NULL, + "COMPONENT_UUID" CHARACTER VARYING(50) NOT NULL, + "HASH" CHARACTER VARYING(50) NOT NULL, "INDEX_IN_FILE" INTEGER NOT NULL, "START_LINE" INTEGER NOT NULL, "END_LINE" INTEGER NOT NULL ); ALTER TABLE "DUPLICATIONS_INDEX" ADD CONSTRAINT "PK_DUPLICATIONS_INDEX" PRIMARY KEY("UUID"); -CREATE INDEX "DUPLICATIONS_INDEX_HASH" ON "DUPLICATIONS_INDEX"("HASH"); -CREATE INDEX "DUPLICATION_ANALYSIS_COMPONENT" ON "DUPLICATIONS_INDEX"("ANALYSIS_UUID", "COMPONENT_UUID"); +CREATE INDEX "DUPLICATIONS_INDEX_HASH" ON "DUPLICATIONS_INDEX"("HASH" NULLS FIRST); +CREATE INDEX "DUPLICATION_ANALYSIS_COMPONENT" ON "DUPLICATIONS_INDEX"("ANALYSIS_UUID" NULLS FIRST, "COMPONENT_UUID" NULLS FIRST); CREATE TABLE "ES_QUEUE"( - "UUID" VARCHAR(40) NOT NULL, - "DOC_TYPE" VARCHAR(40) NOT NULL, - "DOC_ID" VARCHAR(4000) NOT NULL, - "DOC_ID_TYPE" VARCHAR(20), - "DOC_ROUTING" VARCHAR(4000), + "UUID" CHARACTER VARYING(40) NOT NULL, + "DOC_TYPE" CHARACTER VARYING(40) NOT NULL, + "DOC_ID" CHARACTER VARYING(4000) NOT NULL, + "DOC_ID_TYPE" CHARACTER VARYING(20), + "DOC_ROUTING" CHARACTER VARYING(4000), "CREATED_AT" BIGINT NOT NULL ); ALTER TABLE "ES_QUEUE" ADD CONSTRAINT "PK_ES_QUEUE" PRIMARY KEY("UUID"); -CREATE INDEX "ES_QUEUE_CREATED_AT" ON "ES_QUEUE"("CREATED_AT"); +CREATE INDEX "ES_QUEUE_CREATED_AT" ON "ES_QUEUE"("CREATED_AT" NULLS FIRST); CREATE TABLE "EVENT_COMPONENT_CHANGES"( - "UUID" VARCHAR(40) NOT NULL, - "EVENT_UUID" VARCHAR(40) NOT NULL, - "EVENT_COMPONENT_UUID" VARCHAR(50) NOT NULL, - "EVENT_ANALYSIS_UUID" VARCHAR(50) NOT NULL, - "CHANGE_CATEGORY" VARCHAR(12) NOT NULL, - "COMPONENT_UUID" VARCHAR(50) NOT NULL, - "COMPONENT_KEY" VARCHAR(400) NOT NULL, - "COMPONENT_NAME" VARCHAR(2000) NOT NULL, - "COMPONENT_BRANCH_KEY" VARCHAR(255), + "UUID" CHARACTER VARYING(40) NOT NULL, + "EVENT_UUID" CHARACTER VARYING(40) NOT NULL, + "EVENT_COMPONENT_UUID" CHARACTER VARYING(50) NOT NULL, + "EVENT_ANALYSIS_UUID" CHARACTER VARYING(50) NOT NULL, + "CHANGE_CATEGORY" CHARACTER VARYING(12) NOT NULL, + "COMPONENT_UUID" CHARACTER VARYING(50) NOT NULL, + "COMPONENT_KEY" CHARACTER VARYING(400) NOT NULL, + "COMPONENT_NAME" CHARACTER VARYING(2000) NOT NULL, + "COMPONENT_BRANCH_KEY" CHARACTER VARYING(255), "CREATED_AT" BIGINT NOT NULL ); ALTER TABLE "EVENT_COMPONENT_CHANGES" ADD CONSTRAINT "PK_EVENT_COMPONENT_CHANGES" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "EVENT_COMPONENT_CHANGES_UNIQUE" ON "EVENT_COMPONENT_CHANGES"("EVENT_UUID", "CHANGE_CATEGORY", "COMPONENT_UUID"); -CREATE INDEX "EVENT_CPNT_CHANGES_CPNT" ON "EVENT_COMPONENT_CHANGES"("EVENT_COMPONENT_UUID"); -CREATE INDEX "EVENT_CPNT_CHANGES_ANALYSIS" ON "EVENT_COMPONENT_CHANGES"("EVENT_ANALYSIS_UUID"); +CREATE UNIQUE INDEX "EVENT_COMPONENT_CHANGES_UNIQUE" ON "EVENT_COMPONENT_CHANGES"("EVENT_UUID" NULLS FIRST, "CHANGE_CATEGORY" NULLS FIRST, "COMPONENT_UUID" NULLS FIRST); +CREATE INDEX "EVENT_CPNT_CHANGES_CPNT" ON "EVENT_COMPONENT_CHANGES"("EVENT_COMPONENT_UUID" NULLS FIRST); +CREATE INDEX "EVENT_CPNT_CHANGES_ANALYSIS" ON "EVENT_COMPONENT_CHANGES"("EVENT_ANALYSIS_UUID" NULLS FIRST); CREATE TABLE "EVENTS"( - "UUID" VARCHAR(40) NOT NULL, - "ANALYSIS_UUID" VARCHAR(50) NOT NULL, - "NAME" VARCHAR(400), - "CATEGORY" VARCHAR(50), - "DESCRIPTION" VARCHAR(4000), - "EVENT_DATA" VARCHAR(4000), + "UUID" CHARACTER VARYING(40) NOT NULL, + "ANALYSIS_UUID" CHARACTER VARYING(50) NOT NULL, + "NAME" CHARACTER VARYING(400), + "CATEGORY" CHARACTER VARYING(50), + "DESCRIPTION" CHARACTER VARYING(4000), + "EVENT_DATA" CHARACTER VARYING(4000), "EVENT_DATE" BIGINT NOT NULL, "CREATED_AT" BIGINT NOT NULL, - "COMPONENT_UUID" VARCHAR(50) NOT NULL + "COMPONENT_UUID" CHARACTER VARYING(50) NOT NULL ); ALTER TABLE "EVENTS" ADD CONSTRAINT "PK_EVENTS" PRIMARY KEY("UUID"); -CREATE INDEX "EVENTS_ANALYSIS" ON "EVENTS"("ANALYSIS_UUID"); -CREATE INDEX "EVENTS_COMPONENT_UUID" ON "EVENTS"("COMPONENT_UUID"); +CREATE INDEX "EVENTS_ANALYSIS" ON "EVENTS"("ANALYSIS_UUID" NULLS FIRST); +CREATE INDEX "EVENTS_COMPONENT_UUID" ON "EVENTS"("COMPONENT_UUID" NULLS FIRST); CREATE TABLE "FILE_SOURCES"( - "UUID" VARCHAR(40) NOT NULL, - "PROJECT_UUID" VARCHAR(50) NOT NULL, - "FILE_UUID" VARCHAR(50) NOT NULL, - "LINE_HASHES" CLOB, + "UUID" CHARACTER VARYING(40) NOT NULL, + "PROJECT_UUID" CHARACTER VARYING(50) NOT NULL, + "FILE_UUID" CHARACTER VARYING(50) NOT NULL, + "LINE_HASHES" CHARACTER LARGE OBJECT, "LINE_HASHES_VERSION" INTEGER, - "DATA_HASH" VARCHAR(50), - "SRC_HASH" VARCHAR(50), - "REVISION" VARCHAR(100), + "DATA_HASH" CHARACTER VARYING(50), + "SRC_HASH" CHARACTER VARYING(50), + "REVISION" CHARACTER VARYING(100), "LINE_COUNT" INTEGER NOT NULL, - "BINARY_DATA" BLOB, + "BINARY_DATA" BINARY LARGE OBJECT, "CREATED_AT" BIGINT NOT NULL, "UPDATED_AT" BIGINT NOT NULL ); ALTER TABLE "FILE_SOURCES" ADD CONSTRAINT "PK_FILE_SOURCES" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "FILE_SOURCES_FILE_UUID" ON "FILE_SOURCES"("FILE_UUID"); -CREATE INDEX "FILE_SOURCES_PROJECT_UUID" ON "FILE_SOURCES"("PROJECT_UUID"); -CREATE INDEX "FILE_SOURCES_UPDATED_AT" ON "FILE_SOURCES"("UPDATED_AT"); +CREATE UNIQUE INDEX "FILE_SOURCES_FILE_UUID" ON "FILE_SOURCES"("FILE_UUID" NULLS FIRST); +CREATE INDEX "FILE_SOURCES_PROJECT_UUID" ON "FILE_SOURCES"("PROJECT_UUID" NULLS FIRST); +CREATE INDEX "FILE_SOURCES_UPDATED_AT" ON "FILE_SOURCES"("UPDATED_AT" NULLS FIRST); CREATE TABLE "GROUP_ROLES"( - "UUID" VARCHAR(40) NOT NULL, - "ROLE" VARCHAR(64) NOT NULL, - "COMPONENT_UUID" VARCHAR(40), - "GROUP_UUID" VARCHAR(40) + "UUID" CHARACTER VARYING(40) NOT NULL, + "ROLE" CHARACTER VARYING(64) NOT NULL, + "COMPONENT_UUID" CHARACTER VARYING(40), + "GROUP_UUID" CHARACTER VARYING(40) ); ALTER TABLE "GROUP_ROLES" ADD CONSTRAINT "PK_GROUP_ROLES" PRIMARY KEY("UUID"); -CREATE INDEX "GROUP_ROLES_COMPONENT_UUID" ON "GROUP_ROLES"("COMPONENT_UUID"); -CREATE UNIQUE INDEX "UNIQ_GROUP_ROLES" ON "GROUP_ROLES"("GROUP_UUID", "COMPONENT_UUID", "ROLE"); +CREATE INDEX "GROUP_ROLES_COMPONENT_UUID" ON "GROUP_ROLES"("COMPONENT_UUID" NULLS FIRST); +CREATE UNIQUE INDEX "UNIQ_GROUP_ROLES" ON "GROUP_ROLES"("GROUP_UUID" NULLS FIRST, "COMPONENT_UUID" NULLS FIRST, "ROLE" NULLS FIRST); CREATE TABLE "GROUPS"( - "UUID" VARCHAR(40) NOT NULL, - "NAME" VARCHAR(500) NOT NULL, - "DESCRIPTION" VARCHAR(200), + "UUID" CHARACTER VARYING(40) NOT NULL, + "NAME" CHARACTER VARYING(500) NOT NULL, + "DESCRIPTION" CHARACTER VARYING(200), "CREATED_AT" TIMESTAMP, "UPDATED_AT" TIMESTAMP ); ALTER TABLE "GROUPS" ADD CONSTRAINT "PK_GROUPS" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "UNIQ_GROUPS_NAME" ON "GROUPS"("NAME"); +CREATE UNIQUE INDEX "UNIQ_GROUPS_NAME" ON "GROUPS"("NAME" NULLS FIRST); CREATE TABLE "GROUPS_USERS"( - "GROUP_UUID" VARCHAR(40) NOT NULL, - "USER_UUID" VARCHAR(255) NOT NULL + "GROUP_UUID" CHARACTER VARYING(40) NOT NULL, + "USER_UUID" CHARACTER VARYING(255) NOT NULL ); -CREATE INDEX "INDEX_GROUPS_USERS_GROUP_UUID" ON "GROUPS_USERS"("GROUP_UUID"); -CREATE INDEX "INDEX_GROUPS_USERS_USER_UUID" ON "GROUPS_USERS"("USER_UUID"); -CREATE UNIQUE INDEX "GROUPS_USERS_UNIQUE" ON "GROUPS_USERS"("USER_UUID", "GROUP_UUID"); +CREATE INDEX "INDEX_GROUPS_USERS_GROUP_UUID" ON "GROUPS_USERS"("GROUP_UUID" NULLS FIRST); +CREATE INDEX "INDEX_GROUPS_USERS_USER_UUID" ON "GROUPS_USERS"("USER_UUID" NULLS FIRST); +CREATE UNIQUE INDEX "GROUPS_USERS_UNIQUE" ON "GROUPS_USERS"("USER_UUID" NULLS FIRST, "GROUP_UUID" NULLS FIRST); CREATE TABLE "INTERNAL_COMPONENT_PROPS"( - "UUID" VARCHAR(40) NOT NULL, - "COMPONENT_UUID" VARCHAR(50) NOT NULL, - "KEE" VARCHAR(512) NOT NULL, - "VALUE" VARCHAR(4000), + "UUID" CHARACTER VARYING(40) NOT NULL, + "COMPONENT_UUID" CHARACTER VARYING(50) NOT NULL, + "KEE" CHARACTER VARYING(512) NOT NULL, + "VALUE" CHARACTER VARYING(4000), "UPDATED_AT" BIGINT NOT NULL, "CREATED_AT" BIGINT NOT NULL ); ALTER TABLE "INTERNAL_COMPONENT_PROPS" ADD CONSTRAINT "PK_INTERNAL_COMPONENT_PROPS" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "UNIQUE_COMPONENT_UUID_KEE" ON "INTERNAL_COMPONENT_PROPS"("COMPONENT_UUID", "KEE"); +CREATE UNIQUE INDEX "UNIQUE_COMPONENT_UUID_KEE" ON "INTERNAL_COMPONENT_PROPS"("COMPONENT_UUID" NULLS FIRST, "KEE" NULLS FIRST); CREATE TABLE "INTERNAL_PROPERTIES"( - "KEE" VARCHAR(20) NOT NULL, + "KEE" CHARACTER VARYING(20) NOT NULL, "IS_EMPTY" BOOLEAN NOT NULL, - "TEXT_VALUE" VARCHAR(4000), - "CLOB_VALUE" CLOB, + "TEXT_VALUE" CHARACTER VARYING(4000), + "CLOB_VALUE" CHARACTER LARGE OBJECT, "CREATED_AT" BIGINT NOT NULL ); ALTER TABLE "INTERNAL_PROPERTIES" ADD CONSTRAINT "PK_INTERNAL_PROPERTIES" PRIMARY KEY("KEE"); CREATE TABLE "ISSUE_CHANGES"( - "UUID" VARCHAR(40) NOT NULL, - "KEE" VARCHAR(50), - "ISSUE_KEY" VARCHAR(50) NOT NULL, - "USER_LOGIN" VARCHAR(255), - "CHANGE_TYPE" VARCHAR(20), - "CHANGE_DATA" CLOB, + "UUID" CHARACTER VARYING(40) NOT NULL, + "KEE" CHARACTER VARYING(50), + "ISSUE_KEY" CHARACTER VARYING(50) NOT NULL, + "USER_LOGIN" CHARACTER VARYING(255), + "CHANGE_TYPE" CHARACTER VARYING(20), + "CHANGE_DATA" CHARACTER LARGE OBJECT, "CREATED_AT" BIGINT, "UPDATED_AT" BIGINT, "ISSUE_CHANGE_CREATION_DATE" BIGINT, - "PROJECT_UUID" VARCHAR(50) NOT NULL + "PROJECT_UUID" CHARACTER VARYING(50) NOT NULL ); ALTER TABLE "ISSUE_CHANGES" ADD CONSTRAINT "PK_ISSUE_CHANGES" PRIMARY KEY("UUID"); -CREATE INDEX "ISSUE_CHANGES_ISSUE_KEY" ON "ISSUE_CHANGES"("ISSUE_KEY"); -CREATE INDEX "ISSUE_CHANGES_KEE" ON "ISSUE_CHANGES"("KEE"); -CREATE INDEX "ISSUE_CHANGES_PROJECT_UUID" ON "ISSUE_CHANGES"("PROJECT_UUID"); -CREATE INDEX "ISSUE_CHANGES_ISSUE_KEY_TYPE" ON "ISSUE_CHANGES"("ISSUE_KEY", "CHANGE_TYPE"); +CREATE INDEX "ISSUE_CHANGES_ISSUE_KEY" ON "ISSUE_CHANGES"("ISSUE_KEY" NULLS FIRST); +CREATE INDEX "ISSUE_CHANGES_KEE" ON "ISSUE_CHANGES"("KEE" NULLS FIRST); +CREATE INDEX "ISSUE_CHANGES_PROJECT_UUID" ON "ISSUE_CHANGES"("PROJECT_UUID" NULLS FIRST); +CREATE INDEX "ISSUE_CHANGES_ISSUE_KEY_TYPE" ON "ISSUE_CHANGES"("ISSUE_KEY" NULLS FIRST, "CHANGE_TYPE" NULLS FIRST); CREATE TABLE "ISSUES"( - "KEE" VARCHAR(50) NOT NULL, - "RULE_UUID" VARCHAR(40), - "SEVERITY" VARCHAR(10), + "KEE" CHARACTER VARYING(50) NOT NULL, + "RULE_UUID" CHARACTER VARYING(40), + "SEVERITY" CHARACTER VARYING(10), "MANUAL_SEVERITY" BOOLEAN NOT NULL, - "MESSAGE" VARCHAR(4000), + "MESSAGE" CHARACTER VARYING(4000), "LINE" INTEGER, - "GAP" DOUBLE, - "STATUS" VARCHAR(20), - "RESOLUTION" VARCHAR(20), - "CHECKSUM" VARCHAR(1000), - "REPORTER" VARCHAR(255), - "ASSIGNEE" VARCHAR(255), - "AUTHOR_LOGIN" VARCHAR(255), - "ACTION_PLAN_KEY" VARCHAR(50), - "ISSUE_ATTRIBUTES" VARCHAR(4000), + "GAP" DOUBLE PRECISION, + "STATUS" CHARACTER VARYING(20), + "RESOLUTION" CHARACTER VARYING(20), + "CHECKSUM" CHARACTER VARYING(1000), + "REPORTER" CHARACTER VARYING(255), + "ASSIGNEE" CHARACTER VARYING(255), + "AUTHOR_LOGIN" CHARACTER VARYING(255), + "ACTION_PLAN_KEY" CHARACTER VARYING(50), + "ISSUE_ATTRIBUTES" CHARACTER VARYING(4000), "EFFORT" INTEGER, "CREATED_AT" BIGINT, "UPDATED_AT" BIGINT, "ISSUE_CREATION_DATE" BIGINT, "ISSUE_UPDATE_DATE" BIGINT, "ISSUE_CLOSE_DATE" BIGINT, - "TAGS" VARCHAR(4000), - "COMPONENT_UUID" VARCHAR(50), - "PROJECT_UUID" VARCHAR(50), - "LOCATIONS" BLOB, + "TAGS" CHARACTER VARYING(4000), + "COMPONENT_UUID" CHARACTER VARYING(50), + "PROJECT_UUID" CHARACTER VARYING(50), + "LOCATIONS" BINARY LARGE OBJECT, "ISSUE_TYPE" TINYINT, "FROM_HOTSPOT" BOOLEAN, "QUICK_FIX_AVAILABLE" BOOLEAN ); ALTER TABLE "ISSUES" ADD CONSTRAINT "PK_ISSUES" PRIMARY KEY("KEE"); -CREATE INDEX "ISSUES_ASSIGNEE" ON "ISSUES"("ASSIGNEE"); -CREATE INDEX "ISSUES_COMPONENT_UUID" ON "ISSUES"("COMPONENT_UUID"); -CREATE INDEX "ISSUES_CREATION_DATE" ON "ISSUES"("ISSUE_CREATION_DATE"); -CREATE INDEX "ISSUES_PROJECT_UUID" ON "ISSUES"("PROJECT_UUID"); -CREATE INDEX "ISSUES_RESOLUTION" ON "ISSUES"("RESOLUTION"); -CREATE INDEX "ISSUES_UPDATED_AT" ON "ISSUES"("UPDATED_AT"); -CREATE INDEX "ISSUES_RULE_UUID" ON "ISSUES"("RULE_UUID"); +CREATE INDEX "ISSUES_ASSIGNEE" ON "ISSUES"("ASSIGNEE" NULLS FIRST); +CREATE INDEX "ISSUES_COMPONENT_UUID" ON "ISSUES"("COMPONENT_UUID" NULLS FIRST); +CREATE INDEX "ISSUES_CREATION_DATE" ON "ISSUES"("ISSUE_CREATION_DATE" NULLS FIRST); +CREATE INDEX "ISSUES_PROJECT_UUID" ON "ISSUES"("PROJECT_UUID" NULLS FIRST); +CREATE INDEX "ISSUES_RESOLUTION" ON "ISSUES"("RESOLUTION" NULLS FIRST); +CREATE INDEX "ISSUES_UPDATED_AT" ON "ISSUES"("UPDATED_AT" NULLS FIRST); +CREATE INDEX "ISSUES_RULE_UUID" ON "ISSUES"("RULE_UUID" NULLS FIRST); CREATE TABLE "LIVE_MEASURES"( - "UUID" VARCHAR(40) NOT NULL, - "PROJECT_UUID" VARCHAR(50) NOT NULL, - "COMPONENT_UUID" VARCHAR(50) NOT NULL, - "METRIC_UUID" VARCHAR(40) NOT NULL, - "VALUE" DOUBLE, - "TEXT_VALUE" VARCHAR(4000), - "VARIATION" DOUBLE, - "MEASURE_DATA" BLOB, - "UPDATE_MARKER" VARCHAR(40), + "UUID" CHARACTER VARYING(40) NOT NULL, + "PROJECT_UUID" CHARACTER VARYING(50) NOT NULL, + "COMPONENT_UUID" CHARACTER VARYING(50) NOT NULL, + "METRIC_UUID" CHARACTER VARYING(40) NOT NULL, + "VALUE" DOUBLE PRECISION, + "TEXT_VALUE" CHARACTER VARYING(4000), + "VARIATION" DOUBLE PRECISION, + "MEASURE_DATA" BINARY LARGE OBJECT, + "UPDATE_MARKER" CHARACTER VARYING(40), "CREATED_AT" BIGINT NOT NULL, "UPDATED_AT" BIGINT NOT NULL ); ALTER TABLE "LIVE_MEASURES" ADD CONSTRAINT "PK_LIVE_MEASURES" PRIMARY KEY("UUID"); -CREATE INDEX "LIVE_MEASURES_PROJECT" ON "LIVE_MEASURES"("PROJECT_UUID"); -CREATE UNIQUE INDEX "LIVE_MEASURES_COMPONENT" ON "LIVE_MEASURES"("COMPONENT_UUID", "METRIC_UUID"); +CREATE INDEX "LIVE_MEASURES_PROJECT" ON "LIVE_MEASURES"("PROJECT_UUID" NULLS FIRST); +CREATE UNIQUE INDEX "LIVE_MEASURES_COMPONENT" ON "LIVE_MEASURES"("COMPONENT_UUID" NULLS FIRST, "METRIC_UUID" NULLS FIRST); CREATE TABLE "METRICS"( - "UUID" VARCHAR(40) NOT NULL, - "NAME" VARCHAR(64) NOT NULL, - "DESCRIPTION" VARCHAR(255), + "UUID" CHARACTER VARYING(40) NOT NULL, + "NAME" CHARACTER VARYING(64) NOT NULL, + "DESCRIPTION" CHARACTER VARYING(255), "DIRECTION" INTEGER DEFAULT 0 NOT NULL, - "DOMAIN" VARCHAR(64), - "SHORT_NAME" VARCHAR(64), + "DOMAIN" CHARACTER VARYING(64), + "SHORT_NAME" CHARACTER VARYING(64), "QUALITATIVE" BOOLEAN DEFAULT FALSE NOT NULL, - "VAL_TYPE" VARCHAR(8), + "VAL_TYPE" CHARACTER VARYING(8), "ENABLED" BOOLEAN DEFAULT TRUE, - "WORST_VALUE" DOUBLE, - "BEST_VALUE" DOUBLE, + "WORST_VALUE" DOUBLE PRECISION, + "BEST_VALUE" DOUBLE PRECISION, "OPTIMIZED_BEST_VALUE" BOOLEAN, "HIDDEN" BOOLEAN, "DELETE_HISTORICAL_DATA" BOOLEAN, "DECIMAL_SCALE" INTEGER ); ALTER TABLE "METRICS" ADD CONSTRAINT "PK_METRICS" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "METRICS_UNIQUE_NAME" ON "METRICS"("NAME"); +CREATE UNIQUE INDEX "METRICS_UNIQUE_NAME" ON "METRICS"("NAME" NULLS FIRST); CREATE TABLE "NEW_CODE_PERIODS"( - "UUID" VARCHAR(40) NOT NULL, - "PROJECT_UUID" VARCHAR(40), - "BRANCH_UUID" VARCHAR(40), - "TYPE" VARCHAR(30) NOT NULL, - "VALUE" VARCHAR(255), + "UUID" CHARACTER VARYING(40) NOT NULL, + "PROJECT_UUID" CHARACTER VARYING(40), + "BRANCH_UUID" CHARACTER VARYING(40), + "TYPE" CHARACTER VARYING(30) NOT NULL, + "VALUE" CHARACTER VARYING(255), "UPDATED_AT" BIGINT NOT NULL, "CREATED_AT" BIGINT NOT NULL ); ALTER TABLE "NEW_CODE_PERIODS" ADD CONSTRAINT "PK_NEW_CODE_PERIODS" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "UNIQ_NEW_CODE_PERIODS" ON "NEW_CODE_PERIODS"("PROJECT_UUID", "BRANCH_UUID"); -CREATE INDEX "IDX_NCP_TYPE" ON "NEW_CODE_PERIODS"("TYPE"); -CREATE INDEX "IDX_NCP_VALUE" ON "NEW_CODE_PERIODS"("VALUE"); +CREATE UNIQUE INDEX "UNIQ_NEW_CODE_PERIODS" ON "NEW_CODE_PERIODS"("PROJECT_UUID" NULLS FIRST, "BRANCH_UUID" NULLS FIRST); +CREATE INDEX "IDX_NCP_TYPE" ON "NEW_CODE_PERIODS"("TYPE" NULLS FIRST); +CREATE INDEX "IDX_NCP_VALUE" ON "NEW_CODE_PERIODS"("VALUE" NULLS FIRST); CREATE TABLE "NEW_CODE_REFERENCE_ISSUES"( - "UUID" VARCHAR(40) NOT NULL, - "ISSUE_KEY" VARCHAR(50) NOT NULL, + "UUID" CHARACTER VARYING(40) NOT NULL, + "ISSUE_KEY" CHARACTER VARYING(50) NOT NULL, "CREATED_AT" BIGINT NOT NULL ); ALTER TABLE "NEW_CODE_REFERENCE_ISSUES" ADD CONSTRAINT "PK_NEW_CODE_REFERENCE_ISSUES" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "UNIQ_NEW_CODE_REFERENCE_ISSUES" ON "NEW_CODE_REFERENCE_ISSUES"("ISSUE_KEY"); +CREATE UNIQUE INDEX "UNIQ_NEW_CODE_REFERENCE_ISSUES" ON "NEW_CODE_REFERENCE_ISSUES"("ISSUE_KEY" NULLS FIRST); CREATE TABLE "NOTIFICATIONS"( - "UUID" VARCHAR(40) NOT NULL, - "DATA" BLOB, + "UUID" CHARACTER VARYING(40) NOT NULL, + "DATA" BINARY LARGE OBJECT, "CREATED_AT" BIGINT NOT NULL ); ALTER TABLE "NOTIFICATIONS" ADD CONSTRAINT "PK_NOTIFICATIONS" PRIMARY KEY("UUID"); CREATE TABLE "ORG_QPROFILES"( - "UUID" VARCHAR(255) NOT NULL, - "RULES_PROFILE_UUID" VARCHAR(255) NOT NULL, - "PARENT_UUID" VARCHAR(255), + "UUID" CHARACTER VARYING(255) NOT NULL, + "RULES_PROFILE_UUID" CHARACTER VARYING(255) NOT NULL, + "PARENT_UUID" CHARACTER VARYING(255), "LAST_USED" BIGINT, "USER_UPDATED_AT" BIGINT, "CREATED_AT" BIGINT NOT NULL, "UPDATED_AT" BIGINT NOT NULL ); ALTER TABLE "ORG_QPROFILES" ADD CONSTRAINT "PK_ORG_QPROFILES" PRIMARY KEY("UUID"); -CREATE INDEX "QPROFILES_RP_UUID" ON "ORG_QPROFILES"("RULES_PROFILE_UUID"); -CREATE INDEX "ORG_QPROFILES_PARENT_UUID" ON "ORG_QPROFILES"("PARENT_UUID"); +CREATE INDEX "QPROFILES_RP_UUID" ON "ORG_QPROFILES"("RULES_PROFILE_UUID" NULLS FIRST); +CREATE INDEX "ORG_QPROFILES_PARENT_UUID" ON "ORG_QPROFILES"("PARENT_UUID" NULLS FIRST); CREATE TABLE "PERM_TEMPLATES_GROUPS"( - "UUID" VARCHAR(40) NOT NULL, - "PERMISSION_REFERENCE" VARCHAR(64) NOT NULL, + "UUID" CHARACTER VARYING(40) NOT NULL, + "PERMISSION_REFERENCE" CHARACTER VARYING(64) NOT NULL, "CREATED_AT" TIMESTAMP, "UPDATED_AT" TIMESTAMP, - "TEMPLATE_UUID" VARCHAR(40) NOT NULL, - "GROUP_UUID" VARCHAR(40) + "TEMPLATE_UUID" CHARACTER VARYING(40) NOT NULL, + "GROUP_UUID" CHARACTER VARYING(40) ); ALTER TABLE "PERM_TEMPLATES_GROUPS" ADD CONSTRAINT "PK_PERM_TEMPLATES_GROUPS" PRIMARY KEY("UUID"); CREATE TABLE "PERM_TEMPLATES_USERS"( - "UUID" VARCHAR(40) NOT NULL, - "PERMISSION_REFERENCE" VARCHAR(64) NOT NULL, + "UUID" CHARACTER VARYING(40) NOT NULL, + "PERMISSION_REFERENCE" CHARACTER VARYING(64) NOT NULL, "CREATED_AT" TIMESTAMP, "UPDATED_AT" TIMESTAMP, - "TEMPLATE_UUID" VARCHAR(40) NOT NULL, - "USER_UUID" VARCHAR(255) NOT NULL + "TEMPLATE_UUID" CHARACTER VARYING(40) NOT NULL, + "USER_UUID" CHARACTER VARYING(255) NOT NULL ); ALTER TABLE "PERM_TEMPLATES_USERS" ADD CONSTRAINT "PK_PERM_TEMPLATES_USERS" PRIMARY KEY("UUID"); CREATE TABLE "PERM_TPL_CHARACTERISTICS"( - "UUID" VARCHAR(40) NOT NULL, - "PERMISSION_KEY" VARCHAR(64) NOT NULL, + "UUID" CHARACTER VARYING(40) NOT NULL, + "PERMISSION_KEY" CHARACTER VARYING(64) NOT NULL, "WITH_PROJECT_CREATOR" BOOLEAN DEFAULT FALSE NOT NULL, "CREATED_AT" BIGINT NOT NULL, "UPDATED_AT" BIGINT NOT NULL, - "TEMPLATE_UUID" VARCHAR(40) NOT NULL + "TEMPLATE_UUID" CHARACTER VARYING(40) NOT NULL ); ALTER TABLE "PERM_TPL_CHARACTERISTICS" ADD CONSTRAINT "PK_PERM_TPL_CHARACTERISTICS" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "UNIQ_PERM_TPL_CHARAC" ON "PERM_TPL_CHARACTERISTICS"("TEMPLATE_UUID", "PERMISSION_KEY"); +CREATE UNIQUE INDEX "UNIQ_PERM_TPL_CHARAC" ON "PERM_TPL_CHARACTERISTICS"("TEMPLATE_UUID" NULLS FIRST, "PERMISSION_KEY" NULLS FIRST); CREATE TABLE "PERMISSION_TEMPLATES"( - "UUID" VARCHAR(40) NOT NULL, - "NAME" VARCHAR(100) NOT NULL, - "DESCRIPTION" VARCHAR(4000), + "UUID" CHARACTER VARYING(40) NOT NULL, + "NAME" CHARACTER VARYING(100) NOT NULL, + "DESCRIPTION" CHARACTER VARYING(4000), "CREATED_AT" TIMESTAMP, "UPDATED_AT" TIMESTAMP, - "KEY_PATTERN" VARCHAR(500) + "KEY_PATTERN" CHARACTER VARYING(500) ); ALTER TABLE "PERMISSION_TEMPLATES" ADD CONSTRAINT "PK_PERMISSION_TEMPLATES" PRIMARY KEY("UUID"); CREATE TABLE "PLUGINS"( - "UUID" VARCHAR(40) NOT NULL, - "KEE" VARCHAR(200) NOT NULL, - "BASE_PLUGIN_KEY" VARCHAR(200), - "FILE_HASH" VARCHAR(200) NOT NULL, + "UUID" CHARACTER VARYING(40) NOT NULL, + "KEE" CHARACTER VARYING(200) NOT NULL, + "BASE_PLUGIN_KEY" CHARACTER VARYING(200), + "FILE_HASH" CHARACTER VARYING(200) NOT NULL, "CREATED_AT" BIGINT NOT NULL, "UPDATED_AT" BIGINT NOT NULL, - "TYPE" VARCHAR(10) NOT NULL, + "TYPE" CHARACTER VARYING(10) NOT NULL, "REMOVED" BOOLEAN DEFAULT FALSE NOT NULL ); ALTER TABLE "PLUGINS" ADD CONSTRAINT "PK_PLUGINS" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "PLUGINS_KEY" ON "PLUGINS"("KEE"); +CREATE UNIQUE INDEX "PLUGINS_KEY" ON "PLUGINS"("KEE" NULLS FIRST); CREATE TABLE "PORTFOLIO_PROJ_BRANCHES"( - "UUID" VARCHAR(40) NOT NULL, - "PORTFOLIO_PROJECT_UUID" VARCHAR(40) NOT NULL, - "BRANCH_UUID" VARCHAR(40) NOT NULL, + "UUID" CHARACTER VARYING(40) NOT NULL, + "PORTFOLIO_PROJECT_UUID" CHARACTER VARYING(40) NOT NULL, + "BRANCH_UUID" CHARACTER VARYING(40) NOT NULL, "CREATED_AT" BIGINT NOT NULL ); ALTER TABLE "PORTFOLIO_PROJ_BRANCHES" ADD CONSTRAINT "PK_PORTFOLIO_PROJ_BRANCHES" PRIMARY KEY("UUID"); CREATE TABLE "PORTFOLIO_PROJECTS"( - "UUID" VARCHAR(40) NOT NULL, - "PORTFOLIO_UUID" VARCHAR(40) NOT NULL, - "PROJECT_UUID" VARCHAR(40) NOT NULL, + "UUID" CHARACTER VARYING(40) NOT NULL, + "PORTFOLIO_UUID" CHARACTER VARYING(40) NOT NULL, + "PROJECT_UUID" CHARACTER VARYING(40) NOT NULL, "CREATED_AT" BIGINT NOT NULL ); ALTER TABLE "PORTFOLIO_PROJECTS" ADD CONSTRAINT "PK_PORTFOLIO_PROJECTS" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "UNIQ_PORTFOLIO_PROJECTS" ON "PORTFOLIO_PROJECTS"("PORTFOLIO_UUID", "PROJECT_UUID"); +CREATE UNIQUE INDEX "UNIQ_PORTFOLIO_PROJECTS" ON "PORTFOLIO_PROJECTS"("PORTFOLIO_UUID" NULLS FIRST, "PROJECT_UUID" NULLS FIRST); CREATE TABLE "PORTFOLIO_REFERENCES"( - "UUID" VARCHAR(40) NOT NULL, - "PORTFOLIO_UUID" VARCHAR(40) NOT NULL, - "REFERENCE_UUID" VARCHAR(40) NOT NULL, + "UUID" CHARACTER VARYING(40) NOT NULL, + "PORTFOLIO_UUID" CHARACTER VARYING(40) NOT NULL, + "REFERENCE_UUID" CHARACTER VARYING(40) NOT NULL, "CREATED_AT" BIGINT NOT NULL, - "BRANCH_UUID" VARCHAR(255) + "BRANCH_UUID" CHARACTER VARYING(255) ); ALTER TABLE "PORTFOLIO_REFERENCES" ADD CONSTRAINT "PK_PORTFOLIO_REFERENCES" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "UNIQ_PORTFOLIO_REFERENCES" ON "PORTFOLIO_REFERENCES"("PORTFOLIO_UUID", "REFERENCE_UUID", "BRANCH_UUID"); +CREATE UNIQUE INDEX "UNIQ_PORTFOLIO_REFERENCES" ON "PORTFOLIO_REFERENCES"("PORTFOLIO_UUID" NULLS FIRST, "REFERENCE_UUID" NULLS FIRST, "BRANCH_UUID" NULLS FIRST); CREATE TABLE "PORTFOLIOS"( - "UUID" VARCHAR(40) NOT NULL, - "KEE" VARCHAR(400) NOT NULL, - "NAME" VARCHAR(2000) NOT NULL, - "DESCRIPTION" VARCHAR(2000), - "ROOT_UUID" VARCHAR(40) NOT NULL, - "PARENT_UUID" VARCHAR(40), + "UUID" CHARACTER VARYING(40) NOT NULL, + "KEE" CHARACTER VARYING(400) NOT NULL, + "NAME" CHARACTER VARYING(2000) NOT NULL, + "DESCRIPTION" CHARACTER VARYING(2000), + "ROOT_UUID" CHARACTER VARYING(40) NOT NULL, + "PARENT_UUID" CHARACTER VARYING(40), "PRIVATE" BOOLEAN NOT NULL, - "SELECTION_MODE" VARCHAR(50) NOT NULL, - "SELECTION_EXPRESSION" VARCHAR(4000), + "SELECTION_MODE" CHARACTER VARYING(50) NOT NULL, + "SELECTION_EXPRESSION" CHARACTER VARYING(4000), "CREATED_AT" BIGINT NOT NULL, "UPDATED_AT" BIGINT NOT NULL, - "BRANCH_KEY" VARCHAR(255) + "BRANCH_KEY" CHARACTER VARYING(255) ); ALTER TABLE "PORTFOLIOS" ADD CONSTRAINT "PK_PORTFOLIOS" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "UNIQ_PORTFOLIOS_KEE" ON "PORTFOLIOS"("KEE"); +CREATE UNIQUE INDEX "UNIQ_PORTFOLIOS_KEE" ON "PORTFOLIOS"("KEE" NULLS FIRST); CREATE TABLE "PROJECT_ALM_SETTINGS"( - "UUID" VARCHAR(40) NOT NULL, - "ALM_SETTING_UUID" VARCHAR(40) NOT NULL, - "PROJECT_UUID" VARCHAR(50) NOT NULL, - "ALM_REPO" VARCHAR(256), - "ALM_SLUG" VARCHAR(256), + "UUID" CHARACTER VARYING(40) NOT NULL, + "ALM_SETTING_UUID" CHARACTER VARYING(40) NOT NULL, + "PROJECT_UUID" CHARACTER VARYING(50) NOT NULL, + "ALM_REPO" CHARACTER VARYING(256), + "ALM_SLUG" CHARACTER VARYING(256), "UPDATED_AT" BIGINT NOT NULL, "CREATED_AT" BIGINT NOT NULL, "SUMMARY_COMMENT_ENABLED" BOOLEAN, "MONOREPO" BOOLEAN NOT NULL ); ALTER TABLE "PROJECT_ALM_SETTINGS" ADD CONSTRAINT "PK_PROJECT_ALM_SETTINGS" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "UNIQ_PROJECT_ALM_SETTINGS" ON "PROJECT_ALM_SETTINGS"("PROJECT_UUID"); -CREATE INDEX "PROJECT_ALM_SETTINGS_ALM" ON "PROJECT_ALM_SETTINGS"("ALM_SETTING_UUID"); -CREATE INDEX "PROJECT_ALM_SETTINGS_SLUG" ON "PROJECT_ALM_SETTINGS"("ALM_SLUG"); +CREATE UNIQUE INDEX "UNIQ_PROJECT_ALM_SETTINGS" ON "PROJECT_ALM_SETTINGS"("PROJECT_UUID" NULLS FIRST); +CREATE INDEX "PROJECT_ALM_SETTINGS_ALM" ON "PROJECT_ALM_SETTINGS"("ALM_SETTING_UUID" NULLS FIRST); +CREATE INDEX "PROJECT_ALM_SETTINGS_SLUG" ON "PROJECT_ALM_SETTINGS"("ALM_SLUG" NULLS FIRST); CREATE TABLE "PROJECT_BADGE_TOKEN"( - "UUID" VARCHAR(40) NOT NULL, - "TOKEN" VARCHAR(255) NOT NULL, - "PROJECT_UUID" VARCHAR(40) NOT NULL, + "UUID" CHARACTER VARYING(40) NOT NULL, + "TOKEN" CHARACTER VARYING(255) NOT NULL, + "PROJECT_UUID" CHARACTER VARYING(40) NOT NULL, "CREATED_AT" BIGINT NOT NULL, "UPDATED_AT" BIGINT NOT NULL ); ALTER TABLE "PROJECT_BADGE_TOKEN" ADD CONSTRAINT "PK_PROJECT_BADGE_TOKEN" PRIMARY KEY("UUID"); CREATE TABLE "PROJECT_BRANCHES"( - "UUID" VARCHAR(50) NOT NULL, - "PROJECT_UUID" VARCHAR(50) NOT NULL, - "KEE" VARCHAR(255) NOT NULL, - "BRANCH_TYPE" VARCHAR(12) NOT NULL, - "MERGE_BRANCH_UUID" VARCHAR(50), - "PULL_REQUEST_BINARY" BLOB, - "MANUAL_BASELINE_ANALYSIS_UUID" VARCHAR(40), + "UUID" CHARACTER VARYING(50) NOT NULL, + "PROJECT_UUID" CHARACTER VARYING(50) NOT NULL, + "KEE" CHARACTER VARYING(255) NOT NULL, + "BRANCH_TYPE" CHARACTER VARYING(12) NOT NULL, + "MERGE_BRANCH_UUID" CHARACTER VARYING(50), + "PULL_REQUEST_BINARY" BINARY LARGE OBJECT, + "MANUAL_BASELINE_ANALYSIS_UUID" CHARACTER VARYING(40), "CREATED_AT" BIGINT NOT NULL, "UPDATED_AT" BIGINT NOT NULL, "EXCLUDE_FROM_PURGE" BOOLEAN DEFAULT FALSE NOT NULL, "NEED_ISSUE_SYNC" BOOLEAN NOT NULL ); ALTER TABLE "PROJECT_BRANCHES" ADD CONSTRAINT "PK_PROJECT_BRANCHES" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "UNIQ_PROJECT_BRANCHES" ON "PROJECT_BRANCHES"("BRANCH_TYPE", "PROJECT_UUID", "KEE"); +CREATE UNIQUE INDEX "UNIQ_PROJECT_BRANCHES" ON "PROJECT_BRANCHES"("BRANCH_TYPE" NULLS FIRST, "PROJECT_UUID" NULLS FIRST, "KEE" NULLS FIRST); CREATE TABLE "PROJECT_LINKS"( - "UUID" VARCHAR(40) NOT NULL, - "PROJECT_UUID" VARCHAR(40) NOT NULL, - "LINK_TYPE" VARCHAR(20) NOT NULL, - "NAME" VARCHAR(128), - "HREF" VARCHAR(2048) NOT NULL, + "UUID" CHARACTER VARYING(40) NOT NULL, + "PROJECT_UUID" CHARACTER VARYING(40) NOT NULL, + "LINK_TYPE" CHARACTER VARYING(20) NOT NULL, + "NAME" CHARACTER VARYING(128), + "HREF" CHARACTER VARYING(2048) NOT NULL, "CREATED_AT" BIGINT NOT NULL, "UPDATED_AT" BIGINT NOT NULL ); ALTER TABLE "PROJECT_LINKS" ADD CONSTRAINT "PK_PROJECT_LINKS" PRIMARY KEY("UUID"); -CREATE INDEX "PROJECT_LINKS_PROJECT" ON "PROJECT_LINKS"("PROJECT_UUID"); +CREATE INDEX "PROJECT_LINKS_PROJECT" ON "PROJECT_LINKS"("PROJECT_UUID" NULLS FIRST); CREATE TABLE "PROJECT_MAPPINGS"( - "UUID" VARCHAR(40) NOT NULL, - "KEY_TYPE" VARCHAR(200) NOT NULL, - "KEE" VARCHAR(4000) NOT NULL, - "PROJECT_UUID" VARCHAR(40) NOT NULL, + "UUID" CHARACTER VARYING(40) NOT NULL, + "KEY_TYPE" CHARACTER VARYING(200) NOT NULL, + "KEE" CHARACTER VARYING(4000) NOT NULL, + "PROJECT_UUID" CHARACTER VARYING(40) NOT NULL, "CREATED_AT" BIGINT NOT NULL ); ALTER TABLE "PROJECT_MAPPINGS" ADD CONSTRAINT "PK_PROJECT_MAPPINGS" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "KEY_TYPE_KEE" ON "PROJECT_MAPPINGS"("KEY_TYPE", "KEE"); -CREATE INDEX "PROJECT_UUID" ON "PROJECT_MAPPINGS"("PROJECT_UUID"); +CREATE UNIQUE INDEX "KEY_TYPE_KEE" ON "PROJECT_MAPPINGS"("KEY_TYPE" NULLS FIRST, "KEE" NULLS FIRST); +CREATE INDEX "PROJECT_UUID" ON "PROJECT_MAPPINGS"("PROJECT_UUID" NULLS FIRST); CREATE TABLE "PROJECT_MEASURES"( - "UUID" VARCHAR(40) NOT NULL, - "VALUE" DOUBLE, - "ANALYSIS_UUID" VARCHAR(50) NOT NULL, - "COMPONENT_UUID" VARCHAR(50) NOT NULL, - "TEXT_VALUE" VARCHAR(4000), - "ALERT_STATUS" VARCHAR(5), - "ALERT_TEXT" VARCHAR(4000), + "UUID" CHARACTER VARYING(40) NOT NULL, + "VALUE" DOUBLE PRECISION, + "ANALYSIS_UUID" CHARACTER VARYING(50) NOT NULL, + "COMPONENT_UUID" CHARACTER VARYING(50) NOT NULL, + "TEXT_VALUE" CHARACTER VARYING(4000), + "ALERT_STATUS" CHARACTER VARYING(5), + "ALERT_TEXT" CHARACTER VARYING(4000), "PERSON_ID" INTEGER, - "VARIATION_VALUE_1" DOUBLE, - "MEASURE_DATA" BLOB, - "METRIC_UUID" VARCHAR(40) NOT NULL + "VARIATION_VALUE_1" DOUBLE PRECISION, + "MEASURE_DATA" BINARY LARGE OBJECT, + "METRIC_UUID" CHARACTER VARYING(40) NOT NULL ); ALTER TABLE "PROJECT_MEASURES" ADD CONSTRAINT "PK_PROJECT_MEASURES" PRIMARY KEY("UUID"); -CREATE INDEX "MEASURES_COMPONENT_UUID" ON "PROJECT_MEASURES"("COMPONENT_UUID"); -CREATE INDEX "MEASURES_ANALYSIS_METRIC" ON "PROJECT_MEASURES"("ANALYSIS_UUID", "METRIC_UUID"); -CREATE INDEX "PROJECT_MEASURES_METRIC" ON "PROJECT_MEASURES"("METRIC_UUID"); +CREATE INDEX "MEASURES_COMPONENT_UUID" ON "PROJECT_MEASURES"("COMPONENT_UUID" NULLS FIRST); +CREATE INDEX "MEASURES_ANALYSIS_METRIC" ON "PROJECT_MEASURES"("ANALYSIS_UUID" NULLS FIRST, "METRIC_UUID" NULLS FIRST); +CREATE INDEX "PROJECT_MEASURES_METRIC" ON "PROJECT_MEASURES"("METRIC_UUID" NULLS FIRST); CREATE TABLE "PROJECT_QGATES"( - "PROJECT_UUID" VARCHAR(40) NOT NULL, - "QUALITY_GATE_UUID" VARCHAR(40) NOT NULL + "PROJECT_UUID" CHARACTER VARYING(40) NOT NULL, + "QUALITY_GATE_UUID" CHARACTER VARYING(40) NOT NULL ); ALTER TABLE "PROJECT_QGATES" ADD CONSTRAINT "PK_PROJECT_QGATES" PRIMARY KEY("PROJECT_UUID"); -CREATE UNIQUE INDEX "UNIQ_PROJECT_QGATES" ON "PROJECT_QGATES"("PROJECT_UUID", "QUALITY_GATE_UUID"); +CREATE UNIQUE INDEX "UNIQ_PROJECT_QGATES" ON "PROJECT_QGATES"("PROJECT_UUID" NULLS FIRST, "QUALITY_GATE_UUID" NULLS FIRST); CREATE TABLE "PROJECT_QPROFILES"( - "UUID" VARCHAR(40) NOT NULL, - "PROJECT_UUID" VARCHAR(50) NOT NULL, - "PROFILE_KEY" VARCHAR(50) NOT NULL + "UUID" CHARACTER VARYING(40) NOT NULL, + "PROJECT_UUID" CHARACTER VARYING(50) NOT NULL, + "PROFILE_KEY" CHARACTER VARYING(50) NOT NULL ); ALTER TABLE "PROJECT_QPROFILES" ADD CONSTRAINT "PK_PROJECT_QPROFILES" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "UNIQ_PROJECT_QPROFILES" ON "PROJECT_QPROFILES"("PROJECT_UUID", "PROFILE_KEY"); +CREATE UNIQUE INDEX "UNIQ_PROJECT_QPROFILES" ON "PROJECT_QPROFILES"("PROJECT_UUID" NULLS FIRST, "PROFILE_KEY" NULLS FIRST); CREATE TABLE "PROJECTS"( - "UUID" VARCHAR(40) NOT NULL, - "KEE" VARCHAR(400) NOT NULL, - "QUALIFIER" VARCHAR(10) NOT NULL, - "NAME" VARCHAR(2000), - "DESCRIPTION" VARCHAR(2000), + "UUID" CHARACTER VARYING(40) NOT NULL, + "KEE" CHARACTER VARYING(400) NOT NULL, + "QUALIFIER" CHARACTER VARYING(10) NOT NULL, + "NAME" CHARACTER VARYING(2000), + "DESCRIPTION" CHARACTER VARYING(2000), "PRIVATE" BOOLEAN NOT NULL, - "TAGS" VARCHAR(500), + "TAGS" CHARACTER VARYING(500), "CREATED_AT" BIGINT, "UPDATED_AT" BIGINT NOT NULL ); ALTER TABLE "PROJECTS" ADD CONSTRAINT "PK_NEW_PROJECTS" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "UNIQ_PROJECTS_KEE" ON "PROJECTS"("KEE"); -CREATE INDEX "IDX_QUALIFIER" ON "PROJECTS"("QUALIFIER"); +CREATE UNIQUE INDEX "UNIQ_PROJECTS_KEE" ON "PROJECTS"("KEE" NULLS FIRST); +CREATE INDEX "IDX_QUALIFIER" ON "PROJECTS"("QUALIFIER" NULLS FIRST); CREATE TABLE "PROPERTIES"( - "UUID" VARCHAR(40) NOT NULL, - "PROP_KEY" VARCHAR(512) NOT NULL, + "UUID" CHARACTER VARYING(40) NOT NULL, + "PROP_KEY" CHARACTER VARYING(512) NOT NULL, "IS_EMPTY" BOOLEAN NOT NULL, - "TEXT_VALUE" VARCHAR(4000), - "CLOB_VALUE" CLOB, + "TEXT_VALUE" CHARACTER VARYING(4000), + "CLOB_VALUE" CHARACTER LARGE OBJECT, "CREATED_AT" BIGINT NOT NULL, - "COMPONENT_UUID" VARCHAR(40), - "USER_UUID" VARCHAR(255) + "COMPONENT_UUID" CHARACTER VARYING(40), + "USER_UUID" CHARACTER VARYING(255) ); ALTER TABLE "PROPERTIES" ADD CONSTRAINT "PK_PROPERTIES" PRIMARY KEY("UUID"); -CREATE INDEX "PROPERTIES_KEY" ON "PROPERTIES"("PROP_KEY"); +CREATE INDEX "PROPERTIES_KEY" ON "PROPERTIES"("PROP_KEY" NULLS FIRST); CREATE TABLE "QGATE_GROUP_PERMISSIONS"( - "UUID" VARCHAR(40) NOT NULL, - "QUALITY_GATE_UUID" VARCHAR(40) NOT NULL, - "GROUP_UUID" VARCHAR(40) NOT NULL, + "UUID" CHARACTER VARYING(40) NOT NULL, + "QUALITY_GATE_UUID" CHARACTER VARYING(40) NOT NULL, + "GROUP_UUID" CHARACTER VARYING(40) NOT NULL, "CREATED_AT" BIGINT NOT NULL ); ALTER TABLE "QGATE_GROUP_PERMISSIONS" ADD CONSTRAINT "PK_QGATE_GROUP_PERMISSIONS" PRIMARY KEY("UUID"); -CREATE INDEX "QG_GROUPS_UUID_IDX" ON "QGATE_GROUP_PERMISSIONS"("QUALITY_GATE_UUID"); +CREATE INDEX "QG_GROUPS_UUID_IDX" ON "QGATE_GROUP_PERMISSIONS"("QUALITY_GATE_UUID" NULLS FIRST); CREATE TABLE "QGATE_USER_PERMISSIONS"( - "UUID" VARCHAR(40) NOT NULL, - "QUALITY_GATE_UUID" VARCHAR(40) NOT NULL, - "USER_UUID" VARCHAR(40) NOT NULL, + "UUID" CHARACTER VARYING(40) NOT NULL, + "QUALITY_GATE_UUID" CHARACTER VARYING(40) NOT NULL, + "USER_UUID" CHARACTER VARYING(40) NOT NULL, "CREATED_AT" BIGINT NOT NULL ); ALTER TABLE "QGATE_USER_PERMISSIONS" ADD CONSTRAINT "PK_QGATE_USER_PERMISSIONS" PRIMARY KEY("UUID"); -CREATE INDEX "QUALITY_GATE_UUID_IDX" ON "QGATE_USER_PERMISSIONS"("QUALITY_GATE_UUID"); +CREATE INDEX "QUALITY_GATE_UUID_IDX" ON "QGATE_USER_PERMISSIONS"("QUALITY_GATE_UUID" NULLS FIRST); CREATE TABLE "QPROFILE_CHANGES"( - "KEE" VARCHAR(40) NOT NULL, - "RULES_PROFILE_UUID" VARCHAR(255) NOT NULL, - "CHANGE_TYPE" VARCHAR(20) NOT NULL, - "USER_UUID" VARCHAR(255), - "CHANGE_DATA" CLOB, + "KEE" CHARACTER VARYING(40) NOT NULL, + "RULES_PROFILE_UUID" CHARACTER VARYING(255) NOT NULL, + "CHANGE_TYPE" CHARACTER VARYING(20) NOT NULL, + "USER_UUID" CHARACTER VARYING(255), + "CHANGE_DATA" CHARACTER LARGE OBJECT, "CREATED_AT" BIGINT NOT NULL ); ALTER TABLE "QPROFILE_CHANGES" ADD CONSTRAINT "PK_QPROFILE_CHANGES" PRIMARY KEY("KEE"); -CREATE INDEX "QP_CHANGES_RULES_PROFILE_UUID" ON "QPROFILE_CHANGES"("RULES_PROFILE_UUID"); +CREATE INDEX "QP_CHANGES_RULES_PROFILE_UUID" ON "QPROFILE_CHANGES"("RULES_PROFILE_UUID" NULLS FIRST); CREATE TABLE "QPROFILE_EDIT_GROUPS"( - "UUID" VARCHAR(40) NOT NULL, - "QPROFILE_UUID" VARCHAR(255) NOT NULL, + "UUID" CHARACTER VARYING(40) NOT NULL, + "QPROFILE_UUID" CHARACTER VARYING(255) NOT NULL, "CREATED_AT" BIGINT NOT NULL, - "GROUP_UUID" VARCHAR(40) NOT NULL + "GROUP_UUID" CHARACTER VARYING(40) NOT NULL ); ALTER TABLE "QPROFILE_EDIT_GROUPS" ADD CONSTRAINT "PK_QPROFILE_EDIT_GROUPS" PRIMARY KEY("UUID"); -CREATE INDEX "QPROFILE_EDIT_GROUPS_QPROFILE" ON "QPROFILE_EDIT_GROUPS"("QPROFILE_UUID"); -CREATE UNIQUE INDEX "QPROFILE_EDIT_GROUPS_UNIQUE" ON "QPROFILE_EDIT_GROUPS"("GROUP_UUID", "QPROFILE_UUID"); +CREATE INDEX "QPROFILE_EDIT_GROUPS_QPROFILE" ON "QPROFILE_EDIT_GROUPS"("QPROFILE_UUID" NULLS FIRST); +CREATE UNIQUE INDEX "QPROFILE_EDIT_GROUPS_UNIQUE" ON "QPROFILE_EDIT_GROUPS"("GROUP_UUID" NULLS FIRST, "QPROFILE_UUID" NULLS FIRST); CREATE TABLE "QPROFILE_EDIT_USERS"( - "UUID" VARCHAR(40) NOT NULL, - "QPROFILE_UUID" VARCHAR(255) NOT NULL, + "UUID" CHARACTER VARYING(40) NOT NULL, + "QPROFILE_UUID" CHARACTER VARYING(255) NOT NULL, "CREATED_AT" BIGINT NOT NULL, - "USER_UUID" VARCHAR(255) NOT NULL + "USER_UUID" CHARACTER VARYING(255) NOT NULL ); ALTER TABLE "QPROFILE_EDIT_USERS" ADD CONSTRAINT "PK_QPROFILE_EDIT_USERS" PRIMARY KEY("UUID"); -CREATE INDEX "QPROFILE_EDIT_USERS_QPROFILE" ON "QPROFILE_EDIT_USERS"("QPROFILE_UUID"); -CREATE UNIQUE INDEX "QPROFILE_EDIT_USERS_UNIQUE" ON "QPROFILE_EDIT_USERS"("USER_UUID", "QPROFILE_UUID"); +CREATE INDEX "QPROFILE_EDIT_USERS_QPROFILE" ON "QPROFILE_EDIT_USERS"("QPROFILE_UUID" NULLS FIRST); +CREATE UNIQUE INDEX "QPROFILE_EDIT_USERS_UNIQUE" ON "QPROFILE_EDIT_USERS"("USER_UUID" NULLS FIRST, "QPROFILE_UUID" NULLS FIRST); CREATE TABLE "QUALITY_GATE_CONDITIONS"( - "UUID" VARCHAR(40) NOT NULL, - "OPERATOR" VARCHAR(3), - "VALUE_ERROR" VARCHAR(64), + "UUID" CHARACTER VARYING(40) NOT NULL, + "OPERATOR" CHARACTER VARYING(3), + "VALUE_ERROR" CHARACTER VARYING(64), "CREATED_AT" TIMESTAMP, "UPDATED_AT" TIMESTAMP, - "METRIC_UUID" VARCHAR(40) NOT NULL, - "QGATE_UUID" VARCHAR(40) NOT NULL + "METRIC_UUID" CHARACTER VARYING(40) NOT NULL, + "QGATE_UUID" CHARACTER VARYING(40) NOT NULL ); ALTER TABLE "QUALITY_GATE_CONDITIONS" ADD CONSTRAINT "PK_QUALITY_GATE_CONDITIONS" PRIMARY KEY("UUID"); CREATE TABLE "QUALITY_GATES"( - "UUID" VARCHAR(40) NOT NULL, - "NAME" VARCHAR(100) NOT NULL, + "UUID" CHARACTER VARYING(40) NOT NULL, + "NAME" CHARACTER VARYING(100) NOT NULL, "IS_BUILT_IN" BOOLEAN NOT NULL, "CREATED_AT" TIMESTAMP, "UPDATED_AT" TIMESTAMP @@ -811,56 +811,56 @@ CREATE TABLE "QUALITY_GATES"( ALTER TABLE "QUALITY_GATES" ADD CONSTRAINT "PK_QUALITY_GATES" PRIMARY KEY("UUID"); CREATE TABLE "RULE_REPOSITORIES"( - "KEE" VARCHAR(200) NOT NULL, - "LANGUAGE" VARCHAR(20) NOT NULL, - "NAME" VARCHAR(4000) NOT NULL, + "KEE" CHARACTER VARYING(200) NOT NULL, + "LANGUAGE" CHARACTER VARYING(20) NOT NULL, + "NAME" CHARACTER VARYING(4000) NOT NULL, "CREATED_AT" BIGINT NOT NULL ); ALTER TABLE "RULE_REPOSITORIES" ADD CONSTRAINT "PK_RULE_REPOSITORIES" PRIMARY KEY("KEE"); CREATE TABLE "RULES"( - "UUID" VARCHAR(40) NOT NULL, - "NAME" VARCHAR(200), - "PLUGIN_RULE_KEY" VARCHAR(200) NOT NULL, - "PLUGIN_KEY" VARCHAR(200), - "PLUGIN_CONFIG_KEY" VARCHAR(200), - "PLUGIN_NAME" VARCHAR(255) NOT NULL, - "SCOPE" VARCHAR(20) NOT NULL, - "DESCRIPTION" CLOB, + "UUID" CHARACTER VARYING(40) NOT NULL, + "NAME" CHARACTER VARYING(200), + "PLUGIN_RULE_KEY" CHARACTER VARYING(200) NOT NULL, + "PLUGIN_KEY" CHARACTER VARYING(200), + "PLUGIN_CONFIG_KEY" CHARACTER VARYING(200), + "PLUGIN_NAME" CHARACTER VARYING(255) NOT NULL, + "SCOPE" CHARACTER VARYING(20) NOT NULL, + "DESCRIPTION" CHARACTER LARGE OBJECT, "PRIORITY" INTEGER, - "STATUS" VARCHAR(40), - "LANGUAGE" VARCHAR(20), - "DEF_REMEDIATION_FUNCTION" VARCHAR(20), - "DEF_REMEDIATION_GAP_MULT" VARCHAR(20), - "DEF_REMEDIATION_BASE_EFFORT" VARCHAR(20), - "GAP_DESCRIPTION" VARCHAR(4000), - "SYSTEM_TAGS" VARCHAR(4000), + "STATUS" CHARACTER VARYING(40), + "LANGUAGE" CHARACTER VARYING(20), + "DEF_REMEDIATION_FUNCTION" CHARACTER VARYING(20), + "DEF_REMEDIATION_GAP_MULT" CHARACTER VARYING(20), + "DEF_REMEDIATION_BASE_EFFORT" CHARACTER VARYING(20), + "GAP_DESCRIPTION" CHARACTER VARYING(4000), + "SYSTEM_TAGS" CHARACTER VARYING(4000), "IS_TEMPLATE" BOOLEAN DEFAULT FALSE NOT NULL, - "DESCRIPTION_FORMAT" VARCHAR(20), + "DESCRIPTION_FORMAT" CHARACTER VARYING(20), "RULE_TYPE" TINYINT, - "SECURITY_STANDARDS" VARCHAR(4000), + "SECURITY_STANDARDS" CHARACTER VARYING(4000), "IS_AD_HOC" BOOLEAN NOT NULL, "IS_EXTERNAL" BOOLEAN NOT NULL, "CREATED_AT" BIGINT, "UPDATED_AT" BIGINT, - "TEMPLATE_UUID" VARCHAR(40) + "TEMPLATE_UUID" CHARACTER VARYING(40) ); ALTER TABLE "RULES" ADD CONSTRAINT "PK_RULES" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "RULES_REPO_KEY" ON "RULES"("PLUGIN_RULE_KEY", "PLUGIN_NAME"); +CREATE UNIQUE INDEX "RULES_REPO_KEY" ON "RULES"("PLUGIN_RULE_KEY" NULLS FIRST, "PLUGIN_NAME" NULLS FIRST); CREATE TABLE "RULES_METADATA"( - "RULE_UUID" VARCHAR(40) NOT NULL, - "NOTE_DATA" CLOB, - "NOTE_USER_UUID" VARCHAR(255), + "RULE_UUID" CHARACTER VARYING(40) NOT NULL, + "NOTE_DATA" CHARACTER LARGE OBJECT, + "NOTE_USER_UUID" CHARACTER VARYING(255), "NOTE_CREATED_AT" BIGINT, "NOTE_UPDATED_AT" BIGINT, - "REMEDIATION_FUNCTION" VARCHAR(20), - "REMEDIATION_GAP_MULT" VARCHAR(20), - "REMEDIATION_BASE_EFFORT" VARCHAR(20), - "TAGS" VARCHAR(4000), - "AD_HOC_NAME" VARCHAR(200), - "AD_HOC_DESCRIPTION" CLOB, - "AD_HOC_SEVERITY" VARCHAR(10), + "REMEDIATION_FUNCTION" CHARACTER VARYING(20), + "REMEDIATION_GAP_MULT" CHARACTER VARYING(20), + "REMEDIATION_BASE_EFFORT" CHARACTER VARYING(20), + "TAGS" CHARACTER VARYING(4000), + "AD_HOC_NAME" CHARACTER VARYING(200), + "AD_HOC_DESCRIPTION" CHARACTER LARGE OBJECT, + "AD_HOC_SEVERITY" CHARACTER VARYING(10), "AD_HOC_TYPE" TINYINT, "CREATED_AT" BIGINT NOT NULL, "UPDATED_AT" BIGINT NOT NULL @@ -868,128 +868,128 @@ CREATE TABLE "RULES_METADATA"( ALTER TABLE "RULES_METADATA" ADD CONSTRAINT "PK_RULES_METADATA" PRIMARY KEY("RULE_UUID"); CREATE TABLE "RULES_PARAMETERS"( - "UUID" VARCHAR(40) NOT NULL, - "NAME" VARCHAR(128) NOT NULL, - "DESCRIPTION" VARCHAR(4000), - "PARAM_TYPE" VARCHAR(512) NOT NULL, - "DEFAULT_VALUE" VARCHAR(4000), - "RULE_UUID" VARCHAR(40) NOT NULL + "UUID" CHARACTER VARYING(40) NOT NULL, + "NAME" CHARACTER VARYING(128) NOT NULL, + "DESCRIPTION" CHARACTER VARYING(4000), + "PARAM_TYPE" CHARACTER VARYING(512) NOT NULL, + "DEFAULT_VALUE" CHARACTER VARYING(4000), + "RULE_UUID" CHARACTER VARYING(40) NOT NULL ); ALTER TABLE "RULES_PARAMETERS" ADD CONSTRAINT "PK_RULES_PARAMETERS" PRIMARY KEY("UUID"); -CREATE INDEX "RULES_PARAMETERS_RULE_UUID" ON "RULES_PARAMETERS"("RULE_UUID"); -CREATE UNIQUE INDEX "RULES_PARAMETERS_UNIQUE" ON "RULES_PARAMETERS"("RULE_UUID", "NAME"); +CREATE INDEX "RULES_PARAMETERS_RULE_UUID" ON "RULES_PARAMETERS"("RULE_UUID" NULLS FIRST); +CREATE UNIQUE INDEX "RULES_PARAMETERS_UNIQUE" ON "RULES_PARAMETERS"("RULE_UUID" NULLS FIRST, "NAME" NULLS FIRST); CREATE TABLE "RULES_PROFILES"( - "UUID" VARCHAR(40) NOT NULL, - "NAME" VARCHAR(100) NOT NULL, - "LANGUAGE" VARCHAR(20), + "UUID" CHARACTER VARYING(40) NOT NULL, + "NAME" CHARACTER VARYING(100) NOT NULL, + "LANGUAGE" CHARACTER VARYING(20), "IS_BUILT_IN" BOOLEAN NOT NULL, - "RULES_UPDATED_AT" VARCHAR(100), + "RULES_UPDATED_AT" CHARACTER VARYING(100), "CREATED_AT" TIMESTAMP, "UPDATED_AT" TIMESTAMP ); ALTER TABLE "RULES_PROFILES" ADD CONSTRAINT "PK_RULES_PROFILES" PRIMARY KEY("UUID"); CREATE TABLE "SAML_MESSAGE_IDS"( - "UUID" VARCHAR(40) NOT NULL, - "MESSAGE_ID" VARCHAR(255) NOT NULL, + "UUID" CHARACTER VARYING(40) NOT NULL, + "MESSAGE_ID" CHARACTER VARYING(255) NOT NULL, "EXPIRATION_DATE" BIGINT NOT NULL, "CREATED_AT" BIGINT NOT NULL ); ALTER TABLE "SAML_MESSAGE_IDS" ADD CONSTRAINT "PK_SAML_MESSAGE_IDS" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "SAML_MESSAGE_IDS_UNIQUE" ON "SAML_MESSAGE_IDS"("MESSAGE_ID"); +CREATE UNIQUE INDEX "SAML_MESSAGE_IDS_UNIQUE" ON "SAML_MESSAGE_IDS"("MESSAGE_ID" NULLS FIRST); CREATE TABLE "SESSION_TOKENS"( - "UUID" VARCHAR(40) NOT NULL, - "USER_UUID" VARCHAR(255) NOT NULL, + "UUID" CHARACTER VARYING(40) NOT NULL, + "USER_UUID" CHARACTER VARYING(255) NOT NULL, "EXPIRATION_DATE" BIGINT NOT NULL, "CREATED_AT" BIGINT NOT NULL, "UPDATED_AT" BIGINT NOT NULL ); ALTER TABLE "SESSION_TOKENS" ADD CONSTRAINT "PK_SESSION_TOKENS" PRIMARY KEY("UUID"); -CREATE INDEX "SESSION_TOKENS_USER_UUID" ON "SESSION_TOKENS"("USER_UUID"); +CREATE INDEX "SESSION_TOKENS_USER_UUID" ON "SESSION_TOKENS"("USER_UUID" NULLS FIRST); CREATE TABLE "SNAPSHOTS"( - "UUID" VARCHAR(50) NOT NULL, - "COMPONENT_UUID" VARCHAR(50) NOT NULL, - "STATUS" VARCHAR(4) DEFAULT 'U' NOT NULL, + "UUID" CHARACTER VARYING(50) NOT NULL, + "COMPONENT_UUID" CHARACTER VARYING(50) NOT NULL, + "STATUS" CHARACTER VARYING(4) DEFAULT 'U' NOT NULL, "ISLAST" BOOLEAN DEFAULT FALSE NOT NULL, - "VERSION" VARCHAR(500), + "VERSION" CHARACTER VARYING(500), "PURGE_STATUS" INTEGER, - "BUILD_STRING" VARCHAR(100), - "REVISION" VARCHAR(100), + "BUILD_STRING" CHARACTER VARYING(100), + "REVISION" CHARACTER VARYING(100), "BUILD_DATE" BIGINT, - "PERIOD1_MODE" VARCHAR(100), - "PERIOD1_PARAM" VARCHAR(100), + "PERIOD1_MODE" CHARACTER VARYING(100), + "PERIOD1_PARAM" CHARACTER VARYING(100), "PERIOD1_DATE" BIGINT, "CREATED_AT" BIGINT ); ALTER TABLE "SNAPSHOTS" ADD CONSTRAINT "PK_SNAPSHOTS" PRIMARY KEY("UUID"); -CREATE INDEX "SNAPSHOT_COMPONENT" ON "SNAPSHOTS"("COMPONENT_UUID"); +CREATE INDEX "SNAPSHOT_COMPONENT" ON "SNAPSHOTS"("COMPONENT_UUID" NULLS FIRST); CREATE TABLE "USER_DISMISSED_MESSAGES"( - "UUID" VARCHAR(40) NOT NULL, - "USER_UUID" VARCHAR(255) NOT NULL, - "PROJECT_UUID" VARCHAR(40) NOT NULL, - "MESSAGE_TYPE" VARCHAR(255) NOT NULL, + "UUID" CHARACTER VARYING(40) NOT NULL, + "USER_UUID" CHARACTER VARYING(255) NOT NULL, + "PROJECT_UUID" CHARACTER VARYING(40) NOT NULL, + "MESSAGE_TYPE" CHARACTER VARYING(255) NOT NULL, "CREATED_AT" BIGINT NOT NULL ); ALTER TABLE "USER_DISMISSED_MESSAGES" ADD CONSTRAINT "PK_USER_DISMISSED_MESSAGES" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "UNIQ_USER_DISMISSED_MESSAGES" ON "USER_DISMISSED_MESSAGES"("USER_UUID", "PROJECT_UUID", "MESSAGE_TYPE"); -CREATE INDEX "UDM_PROJECT_UUID" ON "USER_DISMISSED_MESSAGES"("PROJECT_UUID"); -CREATE INDEX "UDM_MESSAGE_TYPE" ON "USER_DISMISSED_MESSAGES"("MESSAGE_TYPE"); +CREATE UNIQUE INDEX "UNIQ_USER_DISMISSED_MESSAGES" ON "USER_DISMISSED_MESSAGES"("USER_UUID" NULLS FIRST, "PROJECT_UUID" NULLS FIRST, "MESSAGE_TYPE" NULLS FIRST); +CREATE INDEX "UDM_PROJECT_UUID" ON "USER_DISMISSED_MESSAGES"("PROJECT_UUID" NULLS FIRST); +CREATE INDEX "UDM_MESSAGE_TYPE" ON "USER_DISMISSED_MESSAGES"("MESSAGE_TYPE" NULLS FIRST); CREATE TABLE "USER_PROPERTIES"( - "UUID" VARCHAR(40) NOT NULL, - "USER_UUID" VARCHAR(255) NOT NULL, - "KEE" VARCHAR(100) NOT NULL, - "TEXT_VALUE" VARCHAR(4000) NOT NULL, + "UUID" CHARACTER VARYING(40) NOT NULL, + "USER_UUID" CHARACTER VARYING(255) NOT NULL, + "KEE" CHARACTER VARYING(100) NOT NULL, + "TEXT_VALUE" CHARACTER VARYING(4000) NOT NULL, "CREATED_AT" BIGINT NOT NULL, "UPDATED_AT" BIGINT NOT NULL ); ALTER TABLE "USER_PROPERTIES" ADD CONSTRAINT "PK_USER_PROPERTIES" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "USER_PROPERTIES_USER_UUID_KEE" ON "USER_PROPERTIES"("USER_UUID", "KEE"); +CREATE UNIQUE INDEX "USER_PROPERTIES_USER_UUID_KEE" ON "USER_PROPERTIES"("USER_UUID" NULLS FIRST, "KEE" NULLS FIRST); CREATE TABLE "USER_ROLES"( - "UUID" VARCHAR(40) NOT NULL, - "ROLE" VARCHAR(64) NOT NULL, - "COMPONENT_UUID" VARCHAR(40), - "USER_UUID" VARCHAR(255) + "UUID" CHARACTER VARYING(40) NOT NULL, + "ROLE" CHARACTER VARYING(64) NOT NULL, + "COMPONENT_UUID" CHARACTER VARYING(40), + "USER_UUID" CHARACTER VARYING(255) ); ALTER TABLE "USER_ROLES" ADD CONSTRAINT "PK_USER_ROLES" PRIMARY KEY("UUID"); -CREATE INDEX "USER_ROLES_COMPONENT_UUID" ON "USER_ROLES"("COMPONENT_UUID"); -CREATE INDEX "USER_ROLES_USER" ON "USER_ROLES"("USER_UUID"); +CREATE INDEX "USER_ROLES_COMPONENT_UUID" ON "USER_ROLES"("COMPONENT_UUID" NULLS FIRST); +CREATE INDEX "USER_ROLES_USER" ON "USER_ROLES"("USER_UUID" NULLS FIRST); CREATE TABLE "USER_TOKENS"( - "UUID" VARCHAR(40) NOT NULL, - "USER_UUID" VARCHAR(255) NOT NULL, - "NAME" VARCHAR(100) NOT NULL, - "TOKEN_HASH" VARCHAR(255) NOT NULL, + "UUID" CHARACTER VARYING(40) NOT NULL, + "USER_UUID" CHARACTER VARYING(255) NOT NULL, + "NAME" CHARACTER VARYING(100) NOT NULL, + "TOKEN_HASH" CHARACTER VARYING(255) NOT NULL, "LAST_CONNECTION_DATE" BIGINT, "CREATED_AT" BIGINT NOT NULL ); ALTER TABLE "USER_TOKENS" ADD CONSTRAINT "PK_USER_TOKENS" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "USER_TOKENS_USER_UUID_NAME" ON "USER_TOKENS"("USER_UUID", "NAME"); -CREATE UNIQUE INDEX "USER_TOKENS_TOKEN_HASH" ON "USER_TOKENS"("TOKEN_HASH"); +CREATE UNIQUE INDEX "USER_TOKENS_USER_UUID_NAME" ON "USER_TOKENS"("USER_UUID" NULLS FIRST, "NAME" NULLS FIRST); +CREATE UNIQUE INDEX "USER_TOKENS_TOKEN_HASH" ON "USER_TOKENS"("TOKEN_HASH" NULLS FIRST); CREATE TABLE "USERS"( - "UUID" VARCHAR(255) NOT NULL, - "LOGIN" VARCHAR(255) NOT NULL, - "NAME" VARCHAR(200), - "EMAIL" VARCHAR(100), - "CRYPTED_PASSWORD" VARCHAR(100), - "SALT" VARCHAR(40), - "HASH_METHOD" VARCHAR(10), + "UUID" CHARACTER VARYING(255) NOT NULL, + "LOGIN" CHARACTER VARYING(255) NOT NULL, + "NAME" CHARACTER VARYING(200), + "EMAIL" CHARACTER VARYING(100), + "CRYPTED_PASSWORD" CHARACTER VARYING(100), + "SALT" CHARACTER VARYING(40), + "HASH_METHOD" CHARACTER VARYING(10), "ACTIVE" BOOLEAN DEFAULT TRUE, - "SCM_ACCOUNTS" VARCHAR(4000), - "EXTERNAL_LOGIN" VARCHAR(255) NOT NULL, - "EXTERNAL_IDENTITY_PROVIDER" VARCHAR(100) NOT NULL, - "EXTERNAL_ID" VARCHAR(255) NOT NULL, + "SCM_ACCOUNTS" CHARACTER VARYING(4000), + "EXTERNAL_LOGIN" CHARACTER VARYING(255) NOT NULL, + "EXTERNAL_IDENTITY_PROVIDER" CHARACTER VARYING(100) NOT NULL, + "EXTERNAL_ID" CHARACTER VARYING(255) NOT NULL, "IS_ROOT" BOOLEAN NOT NULL, "USER_LOCAL" BOOLEAN, "ONBOARDED" BOOLEAN NOT NULL, - "HOMEPAGE_TYPE" VARCHAR(40), - "HOMEPAGE_PARAMETER" VARCHAR(40), + "HOMEPAGE_TYPE" CHARACTER VARYING(40), + "HOMEPAGE_PARAMETER" CHARACTER VARYING(40), "LAST_CONNECTION_DATE" BIGINT, "CREATED_AT" BIGINT, "UPDATED_AT" BIGINT, @@ -998,37 +998,37 @@ CREATE TABLE "USERS"( "SONARLINT_AD_SEEN" BOOLEAN DEFAULT FALSE ); ALTER TABLE "USERS" ADD CONSTRAINT "PK_USERS" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "USERS_LOGIN" ON "USERS"("LOGIN"); -CREATE INDEX "USERS_UPDATED_AT" ON "USERS"("UPDATED_AT"); -CREATE UNIQUE INDEX "UNIQ_EXTERNAL_ID" ON "USERS"("EXTERNAL_IDENTITY_PROVIDER", "EXTERNAL_ID"); -CREATE UNIQUE INDEX "UNIQ_EXTERNAL_LOGIN" ON "USERS"("EXTERNAL_IDENTITY_PROVIDER", "EXTERNAL_LOGIN"); +CREATE UNIQUE INDEX "USERS_LOGIN" ON "USERS"("LOGIN" NULLS FIRST); +CREATE INDEX "USERS_UPDATED_AT" ON "USERS"("UPDATED_AT" NULLS FIRST); +CREATE UNIQUE INDEX "UNIQ_EXTERNAL_ID" ON "USERS"("EXTERNAL_IDENTITY_PROVIDER" NULLS FIRST, "EXTERNAL_ID" NULLS FIRST); +CREATE UNIQUE INDEX "UNIQ_EXTERNAL_LOGIN" ON "USERS"("EXTERNAL_IDENTITY_PROVIDER" NULLS FIRST, "EXTERNAL_LOGIN" NULLS FIRST); CREATE TABLE "WEBHOOK_DELIVERIES"( - "UUID" VARCHAR(40) NOT NULL, - "WEBHOOK_UUID" VARCHAR(40) NOT NULL, - "COMPONENT_UUID" VARCHAR(40) NOT NULL, - "CE_TASK_UUID" VARCHAR(40), - "ANALYSIS_UUID" VARCHAR(40), - "NAME" VARCHAR(100) NOT NULL, - "URL" VARCHAR(2000) NOT NULL, + "UUID" CHARACTER VARYING(40) NOT NULL, + "WEBHOOK_UUID" CHARACTER VARYING(40) NOT NULL, + "COMPONENT_UUID" CHARACTER VARYING(40) NOT NULL, + "CE_TASK_UUID" CHARACTER VARYING(40), + "ANALYSIS_UUID" CHARACTER VARYING(40), + "NAME" CHARACTER VARYING(100) NOT NULL, + "URL" CHARACTER VARYING(2000) NOT NULL, "SUCCESS" BOOLEAN NOT NULL, "HTTP_STATUS" INTEGER, "DURATION_MS" BIGINT NOT NULL, - "PAYLOAD" CLOB NOT NULL, - "ERROR_STACKTRACE" CLOB, + "PAYLOAD" CHARACTER LARGE OBJECT NOT NULL, + "ERROR_STACKTRACE" CHARACTER LARGE OBJECT, "CREATED_AT" BIGINT NOT NULL ); ALTER TABLE "WEBHOOK_DELIVERIES" ADD CONSTRAINT "PK_WEBHOOK_DELIVERIES" PRIMARY KEY("UUID"); -CREATE INDEX "COMPONENT_UUID" ON "WEBHOOK_DELIVERIES"("COMPONENT_UUID"); -CREATE INDEX "CE_TASK_UUID" ON "WEBHOOK_DELIVERIES"("CE_TASK_UUID"); -CREATE INDEX "IDX_WBHK_DLVRS_WBHK_UUID" ON "WEBHOOK_DELIVERIES"("WEBHOOK_UUID"); +CREATE INDEX "COMPONENT_UUID" ON "WEBHOOK_DELIVERIES"("COMPONENT_UUID" NULLS FIRST); +CREATE INDEX "CE_TASK_UUID" ON "WEBHOOK_DELIVERIES"("CE_TASK_UUID" NULLS FIRST); +CREATE INDEX "IDX_WBHK_DLVRS_WBHK_UUID" ON "WEBHOOK_DELIVERIES"("WEBHOOK_UUID" NULLS FIRST); CREATE TABLE "WEBHOOKS"( - "UUID" VARCHAR(40) NOT NULL, - "PROJECT_UUID" VARCHAR(40), - "NAME" VARCHAR(100) NOT NULL, - "URL" VARCHAR(2000) NOT NULL, - "SECRET" VARCHAR(200), + "UUID" CHARACTER VARYING(40) NOT NULL, + "PROJECT_UUID" CHARACTER VARYING(40), + "NAME" CHARACTER VARYING(100) NOT NULL, + "URL" CHARACTER VARYING(2000) NOT NULL, + "SECRET" CHARACTER VARYING(200), "CREATED_AT" BIGINT NOT NULL, "UPDATED_AT" BIGINT ); diff --git a/server/sonar-db-dao/src/testFixtures/java/org/sonar/db/SQDatabase.java b/server/sonar-db-dao/src/testFixtures/java/org/sonar/db/SQDatabase.java index db99116233d..169bf9763c2 100644 --- a/server/sonar-db-dao/src/testFixtures/java/org/sonar/db/SQDatabase.java +++ b/server/sonar-db-dao/src/testFixtures/java/org/sonar/db/SQDatabase.java @@ -56,6 +56,7 @@ import org.sonar.server.platform.db.migration.version.DbVersion; import static com.google.common.base.Preconditions.checkState; public class SQDatabase extends DefaultDatabase { + private static final String IGNORED_KEYWORDS_OPTION = ";NON_KEYWORDS=VALUE"; private final boolean createSchema; private SQDatabase(Settings settings, boolean createSchema) { @@ -71,7 +72,7 @@ public class SQDatabase extends DefaultDatabase { MapSettings settings = new MapSettings() .setProperty("sonar.jdbc.dialect", "h2") .setProperty("sonar.jdbc.driverClassName", "org.h2.Driver") - .setProperty("sonar.jdbc.url", "jdbc:h2:mem:" + name) + .setProperty("sonar.jdbc.url", "jdbc:h2:mem:" + name + IGNORED_KEYWORDS_OPTION) .setProperty("sonar.jdbc.username", "sonar") .setProperty("sonar.jdbc.password", "sonar"); return new SQDatabase(settings, createSchema); diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/sql/CreateTableAsBuilder.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/sql/CreateTableAsBuilder.java index afa068f48ad..e08e35aa5ca 100644 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/sql/CreateTableAsBuilder.java +++ b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/sql/CreateTableAsBuilder.java @@ -43,7 +43,7 @@ public class CreateTableAsBuilder { private final Dialect dialect; private final String tableName; private final String fromTableName; - private List<Column> columns = new ArrayList<>(); + private final List<Column> columns = new ArrayList<>(); public CreateTableAsBuilder(Dialect dialect, String tableName, String fromTableName) { this.dialect = requireNonNull(dialect, "dialect can't be null"); @@ -99,8 +99,8 @@ public class CreateTableAsBuilder { } private static class Column { - private ColumnDef columnDef; - private String castFrom; + private final ColumnDef columnDef; + private final String castFrom; public Column(ColumnDef columnDef, @Nullable String castFrom) { this.columnDef = columnDef; diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/sql/DbPrimaryKeyConstraintFinder.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/sql/DbPrimaryKeyConstraintFinder.java index b304e3a2bef..8592132e79b 100644 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/sql/DbPrimaryKeyConstraintFinder.java +++ b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/sql/DbPrimaryKeyConstraintFinder.java @@ -109,7 +109,7 @@ public class DbPrimaryKeyConstraintFinder { private static String getH2ConstraintQuery(String tableName) { return format("SELECT constraint_name " - + "FROM information_schema.constraints " + + "FROM information_schema.table_constraints " + "WHERE table_name = '%s' and constraint_type = 'PRIMARY KEY'", tableName.toUpperCase(Locale.ENGLISH)); } diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/sql/DbPrimaryKeyConstraintFinderTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/sql/DbPrimaryKeyConstraintFinderTest.java index 2f31bc395db..98b20d44f37 100644 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/sql/DbPrimaryKeyConstraintFinderTest.java +++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/sql/DbPrimaryKeyConstraintFinderTest.java @@ -97,6 +97,6 @@ public class DbPrimaryKeyConstraintFinderTest { when(dbMock.getDialect()).thenReturn(H2); assertThat(underTest.getDbVendorSpecificQuery("my_table")) - .isEqualTo("SELECT constraint_name FROM information_schema.constraints WHERE table_name = 'MY_TABLE' and constraint_type = 'PRIMARY KEY'"); + .isEqualTo("SELECT constraint_name FROM information_schema.table_constraints WHERE table_name = 'MY_TABLE' and constraint_type = 'PRIMARY KEY'"); } } diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v00/CreateInitialSchemaTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v00/CreateInitialSchemaTest.java index 664cc2a2bf2..f0aea382df8 100644 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v00/CreateInitialSchemaTest.java +++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v00/CreateInitialSchemaTest.java @@ -35,7 +35,7 @@ public class CreateInitialSchemaTest { @Rule public final CoreDbTester dbTester = CoreDbTester.createForSchema(CreateInitialSchemaTest.class, "empty.sql"); - private CreateInitialSchema underTest = new CreateInitialSchema(dbTester.database()); + private final CreateInitialSchema underTest = new CreateInitialSchema(dbTester.database()); @Test public void creates_tables_on_empty_db() throws Exception { @@ -46,9 +46,13 @@ public class CreateInitialSchemaTest { ResultSet rs = connection.getMetaData().getTables(null, null, null, new String[] {"TABLE"})) { while (rs.next()) { - tables.add(rs.getString("TABLE_NAME").toLowerCase(Locale.ENGLISH)); + String schema = rs.getString("TABLE_SCHEM"); + if (!"INFORMATION_SCHEMA".equalsIgnoreCase(schema)) { + tables.add(rs.getString("TABLE_NAME").toLowerCase(Locale.ENGLISH)); + } } } + assertThat(tables).containsOnly( "active_rules", "active_rule_parameters", diff --git a/server/sonar-main/src/main/java/org/sonar/application/config/JdbcSettings.java b/server/sonar-main/src/main/java/org/sonar/application/config/JdbcSettings.java index 759d02c5a48..0acc34bdfea 100644 --- a/server/sonar-main/src/main/java/org/sonar/application/config/JdbcSettings.java +++ b/server/sonar-main/src/main/java/org/sonar/application/config/JdbcSettings.java @@ -43,7 +43,7 @@ import static org.sonar.process.ProcessProperties.Property.JDBC_URL; import static org.sonar.process.ProcessProperties.Property.PATH_HOME; public class JdbcSettings implements Consumer<Props> { - + private static final String IGNORED_KEYWORDS_OPTION = ";NON_KEYWORDS=VALUE"; private static final int JDBC_EMBEDDED_PORT_DEFAULT_VALUE = 9092; enum Provider { @@ -119,7 +119,7 @@ public class JdbcSettings implements Consumer<Props> { } else { host = ip.getHostAddress(); } - return format("jdbc:h2:tcp://%s:%d/sonar", host, embeddedDatabasePort); + return format("jdbc:h2:tcp://%s:%d/sonar%s", host, embeddedDatabasePort, IGNORED_KEYWORDS_OPTION); } private static void warnIfUrlIsSet(int port, String existing, String expectedUrl) { diff --git a/server/sonar-main/src/test/java/org/sonar/application/config/JdbcSettingsTest.java b/server/sonar-main/src/test/java/org/sonar/application/config/JdbcSettingsTest.java index 58498e4adc6..35b1d8844f4 100644 --- a/server/sonar-main/src/test/java/org/sonar/application/config/JdbcSettingsTest.java +++ b/server/sonar-main/src/test/java/org/sonar/application/config/JdbcSettingsTest.java @@ -56,7 +56,7 @@ public class JdbcSettingsTest { assertThat(underTest.resolveProviderAndEnforceNonnullJdbcUrl(props)) .isEqualTo(Provider.H2); - assertThat(props.nonNullValue(JDBC_URL.getKey())).isEqualTo(String.format("jdbc:h2:tcp://%s:9092/sonar", InetAddress.getLoopbackAddress().getHostAddress())); + assertThat(props.nonNullValue(JDBC_URL.getKey())).isEqualTo(String.format("jdbc:h2:tcp://%s:9092/sonar;NON_KEYWORDS=VALUE", InetAddress.getLoopbackAddress().getHostAddress())); } @Test diff --git a/server/sonar-server-common/src/test/java/org/sonar/server/platform/monitoring/DbSectionTest.java b/server/sonar-server-common/src/test/java/org/sonar/server/platform/monitoring/DbSectionTest.java index 67e283b9b54..57cc4e086e9 100644 --- a/server/sonar-server-common/src/test/java/org/sonar/server/platform/monitoring/DbSectionTest.java +++ b/server/sonar-server-common/src/test/java/org/sonar/server/platform/monitoring/DbSectionTest.java @@ -31,16 +31,16 @@ import static org.sonar.process.systeminfo.SystemInfoUtils.attribute; public class DbSectionTest { @Rule - public DbTester dbTester = DbTester.create(System2.INSTANCE); + public final DbTester dbTester = DbTester.create(System2.INSTANCE); - private DbSection underTest = new DbSection(dbTester.getDbClient()); + private final DbSection underTest = new DbSection(dbTester.getDbClient()); @Test public void db_info() { ProtobufSystemInfo.Section section = underTest.toProtobuf(); SystemInfoTesting.assertThatAttributeIs(section, "Database", "H2"); - assertThat(attribute(section, "Database Version").getStringValue()).startsWith("1."); + assertThat(attribute(section, "Database Version").getStringValue()).startsWith("2."); SystemInfoTesting.assertThatAttributeIs(section, "Username", "SONAR"); - assertThat(attribute(section, "Driver Version").getStringValue()).startsWith("1."); + assertThat(attribute(section, "Driver Version").getStringValue()).startsWith("2."); } } diff --git a/server/sonar-webserver-core/src/main/java/org/sonar/server/platform/db/EmbeddedDatabase.java b/server/sonar-webserver-core/src/main/java/org/sonar/server/platform/db/EmbeddedDatabase.java index 72cb2b2aa33..a31e30d8493 100644 --- a/server/sonar-webserver-core/src/main/java/org/sonar/server/platform/db/EmbeddedDatabase.java +++ b/server/sonar-webserver-core/src/main/java/org/sonar/server/platform/db/EmbeddedDatabase.java @@ -41,6 +41,7 @@ import static org.sonar.process.ProcessProperties.Property.JDBC_USERNAME; import static org.sonar.process.ProcessProperties.Property.PATH_DATA; public class EmbeddedDatabase implements Startable { + private static final String IGNORED_KEYWORDS_OPTION = ";NON_KEYWORDS=VALUE"; private static final Logger LOG = Loggers.get(EmbeddedDatabase.class); private final Configuration config; @@ -108,7 +109,7 @@ public class EmbeddedDatabase implements Startable { } private static void createDatabase(File dbHome, String user, String password) throws SQLException { - String url = format("jdbc:h2:%s/sonar;USER=%s;PASSWORD=%s", dbHome.getAbsolutePath(), user, password); + String url = format("jdbc:h2:%s/sonar;USER=%s;PASSWORD=%s%s", dbHome.getAbsolutePath(), user, password, IGNORED_KEYWORDS_OPTION); DriverManager.registerDriver(new Driver()); DriverManager.getConnection(url).close(); diff --git a/server/sonar-webserver-core/src/test/java/org/sonar/server/platform/db/EmbeddedDatabaseTest.java b/server/sonar-webserver-core/src/test/java/org/sonar/server/platform/db/EmbeddedDatabaseTest.java index 0f4c2ea891a..0a8faedca7f 100644 --- a/server/sonar-webserver-core/src/test/java/org/sonar/server/platform/db/EmbeddedDatabaseTest.java +++ b/server/sonar-webserver-core/src/test/java/org/sonar/server/platform/db/EmbeddedDatabaseTest.java @@ -151,7 +151,7 @@ public class EmbeddedDatabaseTest { private void checkDbIsUp(int port, String user, String password) { try { - String driverUrl = String.format("jdbc:h2:tcp://%s:%d/sonar;USER=%s;PASSWORD=%s", LOOPBACK_ADDRESS, port, user, password); + String driverUrl = String.format("jdbc:h2:tcp://%s:%d/sonar;USER=%s;PASSWORD=%s;NON_KEYWORDS=VALUE", LOOPBACK_ADDRESS, port, user, password); DriverManager.registerDriver(new Driver()); DriverManager.getConnection(driverUrl).close(); } catch (Exception ex) { diff --git a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/issue/WebIssueStorageTest.java b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/issue/WebIssueStorageTest.java index b8e6dfd7e90..8aa563d94ee 100644 --- a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/issue/WebIssueStorageTest.java +++ b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/issue/WebIssueStorageTest.java @@ -199,7 +199,7 @@ public class WebIssueStorageTest { .containsEntry("COMPONENT_UUID", issue.componentUuid()) .containsEntry("EFFORT", updated.effortInMinutes()) .containsEntry("ISSUE_ATTRIBUTES", "fox=bax") - .containsEntry("ISSUE_TYPE", 3) + .containsEntry("ISSUE_TYPE", 3L) .containsEntry("KEE", issue.key()) .containsEntry("LINE", (long) updated.line()) .containsEntry("PROJECT_UUID", updated.projectUuid()) |