From 7a163414fe1eeb2be1754d87c9969c4a68105b5e Mon Sep 17 00:00:00 2001 From: Teryk Bellahsene Date: Fri, 9 Jun 2017 10:32:31 +0200 Subject: [PATCH] SONAR-9304 quality profile uuid with length of 255 characters --- .../src/main/resources/org/sonar/db/version/schema-h2.ddl | 8 ++++---- .../version/v65/CreateTableDefaultQProfiles.java | 4 +++- .../db/migration/version/v65/CreateTableOrgQProfiles.java | 7 ++++--- .../version/v65/CreateTableDefaultQProfilesTest.java | 2 +- .../version/v65/CreateTableOrgQProfilesTest.java | 4 ++-- .../v65/DeleteOrphansFromRulesProfilesTest/initial.sql | 6 +++--- .../version/v65/PopulateOrgQProfilesTest/initial.sql | 6 +++--- .../v65/PopulateTableDefaultQProfilesTest/initial.sql | 2 +- .../initial.sql | 6 +++--- .../initial.sql | 6 +++--- 10 files changed, 27 insertions(+), 24 deletions(-) diff --git a/server/sonar-db-core/src/main/resources/org/sonar/db/version/schema-h2.ddl b/server/sonar-db-core/src/main/resources/org/sonar/db/version/schema-h2.ddl index 3947300eb40..a63c0dde526 100644 --- a/server/sonar-db-core/src/main/resources/org/sonar/db/version/schema-h2.ddl +++ b/server/sonar-db-core/src/main/resources/org/sonar/db/version/schema-h2.ddl @@ -57,10 +57,10 @@ CREATE UNIQUE INDEX "UNIQ_QPROF_KEY" ON "RULES_PROFILES" ("KEE"); CREATE TABLE "ORG_QPROFILES" ( - "UUID" VARCHAR(40) NOT NULL PRIMARY KEY, + "UUID" VARCHAR(255) NOT NULL PRIMARY KEY, "ORGANIZATION_UUID" VARCHAR(40) NOT NULL, - "RULES_PROFILE_UUID" VARCHAR(40) NOT NULL, - "PARENT_UUID" VARCHAR(40), + "RULES_PROFILE_UUID" VARCHAR(255) NOT NULL, + "PARENT_UUID" VARCHAR(255), "LAST_USED" BIGINT, "USER_UPDATED_AT" BIGINT, "CREATED_AT" BIGINT NOT NULL, @@ -73,7 +73,7 @@ CREATE INDEX "ORG_QPROFILES_RP_UUID" ON "ORG_QPROFILES" ("RULES_PROFILE_UUID"); CREATE TABLE "DEFAULT_QPROFILES" ( "ORGANIZATION_UUID" VARCHAR(40) NOT NULL, "LANGUAGE" VARCHAR(20) NOT NULL, - "QPROFILE_UUID" VARCHAR(40) NOT NULL, + "QPROFILE_UUID" VARCHAR(255) NOT NULL, "CREATED_AT" BIGINT NOT NULL, "UPDATED_AT" BIGINT NOT NULL ); diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/CreateTableDefaultQProfiles.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/CreateTableDefaultQProfiles.java index aae41a04170..9e5ebbf9696 100644 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/CreateTableDefaultQProfiles.java +++ b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/CreateTableDefaultQProfiles.java @@ -31,6 +31,8 @@ import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.UUID_S import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.newVarcharColumnDefBuilder; public class CreateTableDefaultQProfiles extends DdlChange { + private static final int QUALITY_PROFILE_UUID_SIZE = 255; + public CreateTableDefaultQProfiles(Database db) { super(db); } @@ -39,7 +41,7 @@ public class CreateTableDefaultQProfiles extends DdlChange { public void execute(Context context) throws SQLException { VarcharColumnDef profileUuidColumn = newVarcharColumnDefBuilder() .setColumnName("qprofile_uuid") - .setLimit(UUID_SIZE) + .setLimit(QUALITY_PROFILE_UUID_SIZE) .setIsNullable(false) .setIgnoreOracleUnit(true) .build(); diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/CreateTableOrgQProfiles.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/CreateTableOrgQProfiles.java index 6126aaef4a8..5df445af74c 100644 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/CreateTableOrgQProfiles.java +++ b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/CreateTableOrgQProfiles.java @@ -33,6 +33,7 @@ import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.newVar public class CreateTableOrgQProfiles extends DdlChange { private static final String TABLE_NAME = "org_qprofiles"; + private static final int QUALITY_PROFILE_UUID_SIZE = 255; public CreateTableOrgQProfiles(Database db) { super(db); @@ -48,7 +49,7 @@ public class CreateTableOrgQProfiles extends DdlChange { .build(); VarcharColumnDef rulesProfileUuid = newVarcharColumnDefBuilder() .setColumnName("rules_profile_uuid") - .setLimit(UUID_SIZE) + .setLimit(QUALITY_PROFILE_UUID_SIZE) .setIsNullable(false) .setIgnoreOracleUnit(true) .build(); @@ -56,14 +57,14 @@ public class CreateTableOrgQProfiles extends DdlChange { new CreateTableBuilder(getDialect(), TABLE_NAME) .addPkColumn(newVarcharColumnDefBuilder() .setColumnName("uuid") - .setLimit(UUID_SIZE) + .setLimit(QUALITY_PROFILE_UUID_SIZE) .setIsNullable(false) .build()) .addColumn(organizationColumn) .addColumn(rulesProfileUuid) .addColumn(newVarcharColumnDefBuilder() .setColumnName("parent_uuid") - .setLimit(UUID_SIZE) + .setLimit(QUALITY_PROFILE_UUID_SIZE) .setIsNullable(true) .setIgnoreOracleUnit(true) .build()) diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v65/CreateTableDefaultQProfilesTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v65/CreateTableDefaultQProfilesTest.java index 88fb3533798..79e249658cb 100644 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v65/CreateTableDefaultQProfilesTest.java +++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v65/CreateTableDefaultQProfilesTest.java @@ -47,7 +47,7 @@ public class CreateTableDefaultQProfilesTest { db.assertColumnDefinition(TABLE, "organization_uuid", Types.VARCHAR, 40, false); db.assertColumnDefinition(TABLE, "language", Types.VARCHAR, 20, false); - db.assertColumnDefinition(TABLE, "qprofile_uuid", Types.VARCHAR, 40, false); + db.assertColumnDefinition(TABLE, "qprofile_uuid", Types.VARCHAR, 255, false); db.assertColumnDefinition(TABLE, "created_at", Types.BIGINT, null, false); db.assertColumnDefinition(TABLE, "updated_at", Types.BIGINT, null, false); db.assertPrimaryKey(TABLE, "pk_" + TABLE, "organization_uuid", "language"); diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v65/CreateTableOrgQProfilesTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v65/CreateTableOrgQProfilesTest.java index ed4a8eb6fac..197a6d37b23 100644 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v65/CreateTableOrgQProfilesTest.java +++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v65/CreateTableOrgQProfilesTest.java @@ -46,10 +46,10 @@ public class CreateTableOrgQProfilesTest { assertThat(db.countRowsOfTable(TABLE)).isEqualTo(0); - db.assertColumnDefinition(TABLE, "uuid", Types.VARCHAR, 40, false); + db.assertColumnDefinition(TABLE, "uuid", Types.VARCHAR, 255, false); db.assertPrimaryKey(TABLE, "pk_org_qprofiles", "uuid"); db.assertColumnDefinition(TABLE, "organization_uuid", Types.VARCHAR, 40, false); - db.assertColumnDefinition(TABLE, "rules_profile_uuid", Types.VARCHAR, 40, false); + db.assertColumnDefinition(TABLE, "rules_profile_uuid", Types.VARCHAR, 255, false); db.assertColumnDefinition(TABLE, "last_used", Types.BIGINT, null, true); db.assertColumnDefinition(TABLE, "user_updated_at", Types.BIGINT, null, true); db.assertColumnDefinition(TABLE, "created_at", Types.BIGINT, null, false); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v65/DeleteOrphansFromRulesProfilesTest/initial.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v65/DeleteOrphansFromRulesProfilesTest/initial.sql index 677da02ee59..7c23f212676 100644 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v65/DeleteOrphansFromRulesProfilesTest/initial.sql +++ b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v65/DeleteOrphansFromRulesProfilesTest/initial.sql @@ -13,10 +13,10 @@ CREATE TABLE "RULES_PROFILES" ( CREATE UNIQUE INDEX "UNIQ_QPROF_KEY" ON "RULES_PROFILES" ("KEE"); CREATE TABLE "ORG_QPROFILES" ( - "UUID" VARCHAR(40) NOT NULL PRIMARY KEY, + "UUID" VARCHAR(255) NOT NULL PRIMARY KEY, "ORGANIZATION_UUID" VARCHAR(40) NOT NULL, - "RULES_PROFILE_UUID" VARCHAR(40) NOT NULL, - "PARENT_UUID" VARCHAR(40), + "RULES_PROFILE_UUID" VARCHAR(255) NOT NULL, + "PARENT_UUID" VARCHAR(255), "CREATED_AT" BIGINT NOT NULL, "UPDATED_AT" BIGINT NOT NULL ); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v65/PopulateOrgQProfilesTest/initial.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v65/PopulateOrgQProfilesTest/initial.sql index 2990757445e..ca6b10cad6e 100644 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v65/PopulateOrgQProfilesTest/initial.sql +++ b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v65/PopulateOrgQProfilesTest/initial.sql @@ -16,10 +16,10 @@ CREATE TABLE "RULES_PROFILES" ( CREATE UNIQUE INDEX "UNIQ_QPROF_KEY" ON "RULES_PROFILES" ("KEE"); CREATE TABLE "ORG_QPROFILES" ( - "UUID" VARCHAR(40) NOT NULL PRIMARY KEY, + "UUID" VARCHAR(255) NOT NULL PRIMARY KEY, "ORGANIZATION_UUID" VARCHAR(40) NOT NULL, - "RULES_PROFILE_UUID" VARCHAR(40) NOT NULL, - "PARENT_UUID" VARCHAR(40), + "RULES_PROFILE_UUID" VARCHAR(255) NOT NULL, + "PARENT_UUID" VARCHAR(255), "LAST_USED" BIGINT, "USER_UPDATED_AT" BIGINT, "CREATED_AT" BIGINT NOT NULL, diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v65/PopulateTableDefaultQProfilesTest/initial.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v65/PopulateTableDefaultQProfilesTest/initial.sql index b1145235184..06d6511fbf8 100644 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v65/PopulateTableDefaultQProfilesTest/initial.sql +++ b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v65/PopulateTableDefaultQProfilesTest/initial.sql @@ -19,7 +19,7 @@ CREATE UNIQUE INDEX "UNIQ_QPROF_KEY" ON "RULES_PROFILES" ("KEE"); CREATE TABLE "DEFAULT_QPROFILES" ( "ORGANIZATION_UUID" VARCHAR(40) NOT NULL, "LANGUAGE" VARCHAR(20) NOT NULL, - "QPROFILE_UUID" VARCHAR(40) NOT NULL, + "QPROFILE_UUID" VARCHAR(255) NOT NULL, "CREATED_AT" BIGINT, "UPDATED_AT" BIGINT ); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v65/SetRulesProfilesIsBuiltInToTrueForDefaultOrganizationTest/initial.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v65/SetRulesProfilesIsBuiltInToTrueForDefaultOrganizationTest/initial.sql index 66a0a275bc5..041f3acd203 100644 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v65/SetRulesProfilesIsBuiltInToTrueForDefaultOrganizationTest/initial.sql +++ b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v65/SetRulesProfilesIsBuiltInToTrueForDefaultOrganizationTest/initial.sql @@ -13,10 +13,10 @@ CREATE TABLE "RULES_PROFILES" ( CREATE UNIQUE INDEX "UNIQ_QPROF_KEY" ON "RULES_PROFILES" ("KEE"); CREATE TABLE "ORG_QPROFILES" ( - "UUID" VARCHAR(40) NOT NULL PRIMARY KEY, + "UUID" VARCHAR(255) NOT NULL PRIMARY KEY, "ORGANIZATION_UUID" VARCHAR(40) NOT NULL, - "RULES_PROFILE_UUID" VARCHAR(40) NOT NULL, - "PARENT_UUID" VARCHAR(40), + "RULES_PROFILE_UUID" VARCHAR(255) NOT NULL, + "PARENT_UUID" VARCHAR(255), "CREATED_AT" BIGINT NOT NULL, "UPDATED_AT" BIGINT NOT NULL ); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v65/UpdateOrgQProfilesToPointToBuiltInProfilesTest/initial.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v65/UpdateOrgQProfilesToPointToBuiltInProfilesTest/initial.sql index 1cd770393e1..6ce198e77d6 100644 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v65/UpdateOrgQProfilesToPointToBuiltInProfilesTest/initial.sql +++ b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v65/UpdateOrgQProfilesToPointToBuiltInProfilesTest/initial.sql @@ -11,10 +11,10 @@ CREATE TABLE "RULES_PROFILES" ( CREATE UNIQUE INDEX "UNIQ_QPROF_KEY" ON "RULES_PROFILES" ("KEE"); CREATE TABLE "ORG_QPROFILES" ( - "UUID" VARCHAR(40) NOT NULL PRIMARY KEY, + "UUID" VARCHAR(255) NOT NULL PRIMARY KEY, "ORGANIZATION_UUID" VARCHAR(40) NOT NULL, - "RULES_PROFILE_UUID" VARCHAR(40) NOT NULL, - "PARENT_UUID" VARCHAR(40), + "RULES_PROFILE_UUID" VARCHAR(255) NOT NULL, + "PARENT_UUID" VARCHAR(255), "LAST_USED" BIGINT, "USER_UPDATED_AT" BIGINT, "CREATED_AT" BIGINT NOT NULL, -- 2.39.5