aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--server/sonar-db-core/src/main/resources/org/sonar/db/version/schema-h2.ddl2
-rw-r--r--server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v72/AddUUIDtoUsers.java6
-rw-r--r--server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v72/AddUniqueIndexesOnUsers.java2
-rw-r--r--server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v72/MakeSomeColumnsOfUsersNotNullable.java2
-rw-r--r--server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v72/AddUUIDtoUsersTest.java2
-rw-r--r--server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v72/MakeSomeColumnsOfUsersNotNullableTest.java4
-rw-r--r--server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v72/PopulateUUIDOnUsersTest.java16
-rw-r--r--server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v72/AddExternalIdToUsersTest/users.sql2
-rw-r--r--server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v72/AddOrganizationUuidToUsersTest/users.sql2
-rw-r--r--server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v72/AddUniqueIndexesOnUsersTest/users.sql2
-rw-r--r--server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v72/MakeSomeColumnsOfUsersNotNullableTest/users.sql2
-rw-r--r--server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v72/PopulateExternalIdOnUsersTest/users.sql2
-rw-r--r--server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v72/PopulateOrganizationUuidOnUsersTest/schema.sql2
-rw-r--r--server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v72/PopulateUUIDOnUsersTest/users.sql2
-rw-r--r--server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v72/RenameExternalIdentityToExternalLoginOnUsersTest/users.sql2
-rw-r--r--server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v72/UpdateNullValuesFromExternalColumnsAndLoginOfUsersTest/users.sql2
16 files changed, 29 insertions, 23 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 1718c97533d..83a3091a455 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
@@ -453,7 +453,7 @@ CREATE INDEX "IX_ARP_ON_ACTIVE_RULE_ID" ON "ACTIVE_RULE_PARAMETERS" ("ACTIVE_RUL
CREATE TABLE "USERS" (
"ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1),
- "UUID" VARCHAR(40) NOT NULL,
+ "UUID" VARCHAR(255) NOT NULL,
"LOGIN" VARCHAR(255) NOT NULL,
"NAME" VARCHAR(200),
"EMAIL" VARCHAR(100),
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v72/AddUUIDtoUsers.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v72/AddUUIDtoUsers.java
index d05abca5a63..cc5ca02cdfe 100644
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v72/AddUUIDtoUsers.java
+++ b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v72/AddUUIDtoUsers.java
@@ -19,18 +19,18 @@
*/
package org.sonar.server.platform.db.migration.version.v72;
+import java.sql.SQLException;
import org.sonar.db.Database;
import org.sonar.server.platform.db.migration.def.VarcharColumnDef;
import org.sonar.server.platform.db.migration.sql.AddColumnsBuilder;
import org.sonar.server.platform.db.migration.step.DdlChange;
-import java.sql.SQLException;
-
public class AddUUIDtoUsers extends DdlChange {
private static final String TABLE_NAME = "users";
private static final String UUID_COLUMN_NAME = "uuid";
- private static final int UUID_LENGTH = 40;
+ // We need to use a length of 255 as the migration that fed it will use login, which are using a length of 255
+ private static final int UUID_LENGTH = 255;
public AddUUIDtoUsers(Database db) {
super(db);
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v72/AddUniqueIndexesOnUsers.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v72/AddUniqueIndexesOnUsers.java
index 41dfef1548d..2092c717cef 100644
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v72/AddUniqueIndexesOnUsers.java
+++ b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v72/AddUniqueIndexesOnUsers.java
@@ -39,7 +39,7 @@ public class AddUniqueIndexesOnUsers extends DdlChange {
.setTable("users")
.setName("users_uuid")
.setUnique(true)
- .addColumn(notNullableColumn("uuid", 40))
+ .addColumn(notNullableColumn("uuid", 255))
.build());
context.execute(new CreateIndexBuilder(getDialect())
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v72/MakeSomeColumnsOfUsersNotNullable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v72/MakeSomeColumnsOfUsersNotNullable.java
index 82f18e8d28f..ca518bf7bdb 100644
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v72/MakeSomeColumnsOfUsersNotNullable.java
+++ b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v72/MakeSomeColumnsOfUsersNotNullable.java
@@ -46,7 +46,7 @@ public class MakeSomeColumnsOfUsersNotNullable extends DdlChange {
.build());
context.execute(new AlterColumnsBuilder(getDialect(), USERS_TABLE)
- .updateColumn(notNullableColumn("uuid", 40))
+ .updateColumn(notNullableColumn("uuid", 255))
.updateColumn(notNullableColumn("login", 255))
.updateColumn(notNullableColumn("external_id", 255))
.updateColumn(notNullableColumn("external_login", 255))
diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v72/AddUUIDtoUsersTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v72/AddUUIDtoUsersTest.java
index 29165a3543c..29b1f06ab94 100644
--- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v72/AddUUIDtoUsersTest.java
+++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v72/AddUUIDtoUsersTest.java
@@ -43,7 +43,7 @@ public class AddUUIDtoUsersTest {
public void column_is_added_to_table() throws SQLException {
underTest.execute();
- dbTester.assertColumnDefinition("users", "uuid", VARCHAR, 40, true);
+ dbTester.assertColumnDefinition("users", "uuid", VARCHAR, 255, true);
}
@Test
diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v72/MakeSomeColumnsOfUsersNotNullableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v72/MakeSomeColumnsOfUsersNotNullableTest.java
index 73c60165234..98eb7305850 100644
--- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v72/MakeSomeColumnsOfUsersNotNullableTest.java
+++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v72/MakeSomeColumnsOfUsersNotNullableTest.java
@@ -38,7 +38,7 @@ public class MakeSomeColumnsOfUsersNotNullableTest {
public void columns_are_set_as_not_nullable() throws SQLException {
underTest.execute();
- db.assertColumnDefinition("users", "uuid", VARCHAR, 40, false);
+ db.assertColumnDefinition("users", "uuid", VARCHAR, 255, false);
db.assertColumnDefinition("users", "login", VARCHAR, 255, false);
db.assertColumnDefinition("users", "external_id", VARCHAR, 255, false);
db.assertColumnDefinition("users", "external_login", VARCHAR, 255, false);
@@ -51,7 +51,7 @@ public class MakeSomeColumnsOfUsersNotNullableTest {
underTest.execute();
underTest.execute();
- db.assertColumnDefinition("users", "uuid", VARCHAR, 40, false);
+ db.assertColumnDefinition("users", "uuid", VARCHAR, 255, false);
db.assertColumnDefinition("users", "login", VARCHAR, 255, false);
db.assertColumnDefinition("users", "external_id", VARCHAR, 255, false);
db.assertColumnDefinition("users", "external_login", VARCHAR, 255, false);
diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v72/PopulateUUIDOnUsersTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v72/PopulateUUIDOnUsersTest.java
index 948a36cff7a..609eefe532d 100644
--- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v72/PopulateUUIDOnUsersTest.java
+++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v72/PopulateUUIDOnUsersTest.java
@@ -19,11 +19,9 @@
*/
package org.sonar.server.platform.db.migration.version.v72;
+import com.google.common.base.Strings;
import java.sql.SQLException;
import java.util.ArrayList;
-import java.util.Date;
-import java.util.stream.Collectors;
-
import org.assertj.core.groups.Tuple;
import org.junit.Rule;
import org.junit.Test;
@@ -62,7 +60,6 @@ public class PopulateUUIDOnUsersTest {
@Test
public void update_uuid_when_login_is_present() throws SQLException {
-
String login1 = insertUser(NO_UUID, randomAlphanumeric(10));
String login2 = insertUser(NO_UUID, randomAlphanumeric(10));
String login3 = insertUser(NO_UUID, randomAlphanumeric(10));
@@ -77,6 +74,15 @@ public class PopulateUUIDOnUsersTest {
}
@Test
+ public void check_max_length() throws Exception {
+ String login = insertUser(NO_UUID, Strings.repeat("a", 255));
+
+ underTest.execute();
+
+ assertUser(tuple(login, login, PAST, NOW));
+ }
+
+ @Test
public void generate_random_uuid_when_login_is_null() throws SQLException {
insertUser(NO_UUID, NO_LOGIN);
insertUser(NO_UUID, NO_LOGIN);
@@ -88,7 +94,7 @@ public class PopulateUUIDOnUsersTest {
}
@Test
- public void _do_nothing_when_uuid_is_already_present() throws SQLException {
+ public void do_nothing_when_uuid_is_already_present() throws SQLException {
String login1 = insertUser(NO_UUID, randomAlphanumeric(10));
String login2 = insertUser("existing-uuid", randomAlphanumeric(10));
diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v72/AddExternalIdToUsersTest/users.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v72/AddExternalIdToUsersTest/users.sql
index c1d3972c0b5..63f3678158c 100644
--- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v72/AddExternalIdToUsersTest/users.sql
+++ b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v72/AddExternalIdToUsersTest/users.sql
@@ -1,6 +1,6 @@
CREATE TABLE "USERS" (
"ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1),
- "UUID" VARCHAR(40),
+ "UUID" VARCHAR(255),
"LOGIN" VARCHAR(255),
"NAME" VARCHAR(200),
"EMAIL" VARCHAR(100),
diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v72/AddOrganizationUuidToUsersTest/users.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v72/AddOrganizationUuidToUsersTest/users.sql
index 74cb1f15571..3d35b327f62 100644
--- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v72/AddOrganizationUuidToUsersTest/users.sql
+++ b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v72/AddOrganizationUuidToUsersTest/users.sql
@@ -1,6 +1,6 @@
CREATE TABLE "USERS" (
"ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1),
- "UUID" VARCHAR(40) NOT NULL,
+ "UUID" VARCHAR(255) NOT NULL,
"LOGIN" VARCHAR(255) NOT NULL,
"NAME" VARCHAR(200),
"EMAIL" VARCHAR(100),
diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v72/AddUniqueIndexesOnUsersTest/users.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v72/AddUniqueIndexesOnUsersTest/users.sql
index a63e0aeb4db..5d8477543c8 100644
--- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v72/AddUniqueIndexesOnUsersTest/users.sql
+++ b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v72/AddUniqueIndexesOnUsersTest/users.sql
@@ -1,6 +1,6 @@
CREATE TABLE "USERS" (
"ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1),
- "UUID" VARCHAR(40),
+ "UUID" VARCHAR(255),
"LOGIN" VARCHAR(255),
"NAME" VARCHAR(200),
"EMAIL" VARCHAR(100),
diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v72/MakeSomeColumnsOfUsersNotNullableTest/users.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v72/MakeSomeColumnsOfUsersNotNullableTest/users.sql
index a63e0aeb4db..5d8477543c8 100644
--- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v72/MakeSomeColumnsOfUsersNotNullableTest/users.sql
+++ b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v72/MakeSomeColumnsOfUsersNotNullableTest/users.sql
@@ -1,6 +1,6 @@
CREATE TABLE "USERS" (
"ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1),
- "UUID" VARCHAR(40),
+ "UUID" VARCHAR(255),
"LOGIN" VARCHAR(255),
"NAME" VARCHAR(200),
"EMAIL" VARCHAR(100),
diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v72/PopulateExternalIdOnUsersTest/users.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v72/PopulateExternalIdOnUsersTest/users.sql
index a63e0aeb4db..5d8477543c8 100644
--- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v72/PopulateExternalIdOnUsersTest/users.sql
+++ b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v72/PopulateExternalIdOnUsersTest/users.sql
@@ -1,6 +1,6 @@
CREATE TABLE "USERS" (
"ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1),
- "UUID" VARCHAR(40),
+ "UUID" VARCHAR(255),
"LOGIN" VARCHAR(255),
"NAME" VARCHAR(200),
"EMAIL" VARCHAR(100),
diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v72/PopulateOrganizationUuidOnUsersTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v72/PopulateOrganizationUuidOnUsersTest/schema.sql
index 194d7960153..a3d5dc0b618 100644
--- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v72/PopulateOrganizationUuidOnUsersTest/schema.sql
+++ b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v72/PopulateOrganizationUuidOnUsersTest/schema.sql
@@ -1,6 +1,6 @@
CREATE TABLE "USERS" (
"ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1),
- "UUID" VARCHAR(40) NOT NULL,
+ "UUID" VARCHAR(255) NOT NULL,
"LOGIN" VARCHAR(255) NOT NULL,
"NAME" VARCHAR(200),
"EMAIL" VARCHAR(100),
diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v72/PopulateUUIDOnUsersTest/users.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v72/PopulateUUIDOnUsersTest/users.sql
index 9f03d34955f..d5b823e4b60 100644
--- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v72/PopulateUUIDOnUsersTest/users.sql
+++ b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v72/PopulateUUIDOnUsersTest/users.sql
@@ -1,6 +1,6 @@
CREATE TABLE "USERS" (
"ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1),
- "UUID" VARCHAR(40),
+ "UUID" VARCHAR(255),
"LOGIN" VARCHAR(255),
"NAME" VARCHAR(200),
"EMAIL" VARCHAR(100),
diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v72/RenameExternalIdentityToExternalLoginOnUsersTest/users.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v72/RenameExternalIdentityToExternalLoginOnUsersTest/users.sql
index 19dc45a3dd6..c88da101896 100644
--- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v72/RenameExternalIdentityToExternalLoginOnUsersTest/users.sql
+++ b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v72/RenameExternalIdentityToExternalLoginOnUsersTest/users.sql
@@ -1,6 +1,6 @@
CREATE TABLE "USERS" (
"ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1),
- "UUID" VARCHAR(40),
+ "UUID" VARCHAR(255),
"LOGIN" VARCHAR(255),
"NAME" VARCHAR(200),
"EMAIL" VARCHAR(100),
diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v72/UpdateNullValuesFromExternalColumnsAndLoginOfUsersTest/users.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v72/UpdateNullValuesFromExternalColumnsAndLoginOfUsersTest/users.sql
index a63e0aeb4db..5d8477543c8 100644
--- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v72/UpdateNullValuesFromExternalColumnsAndLoginOfUsersTest/users.sql
+++ b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v72/UpdateNullValuesFromExternalColumnsAndLoginOfUsersTest/users.sql
@@ -1,6 +1,6 @@
CREATE TABLE "USERS" (
"ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1),
- "UUID" VARCHAR(40),
+ "UUID" VARCHAR(255),
"LOGIN" VARCHAR(255),
"NAME" VARCHAR(200),
"EMAIL" VARCHAR(100),