aboutsummaryrefslogtreecommitdiffstats
path: root/server
diff options
context:
space:
mode:
authorJacek <jacek.poreda@sonarsource.com>2022-01-25 13:39:27 +0100
committersonartech <sonartech@sonarsource.com>2022-01-25 20:03:05 +0000
commit8c00e44b06dc81136484e1541400ea766612d8d6 (patch)
tree79d9599182182b5906d19e14cac82558057b4996 /server
parentdcd83ed960518f9250bd90d548a9f18a9913261f (diff)
downloadsonarqube-8c00e44b06dc81136484e1541400ea766612d8d6.tar.gz
sonarqube-8c00e44b06dc81136484e1541400ea766612d8d6.zip
SONAR-15760 Increase selection_expression column size
Diffstat (limited to 'server')
-rw-r--r--server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v91/CreatePortfoliosTable.java3
-rw-r--r--server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v91/CreatePortfoliosTableTest.java13
2 files changed, 14 insertions, 2 deletions
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v91/CreatePortfoliosTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v91/CreatePortfoliosTable.java
index 3069bb60724..4fe3797abba 100644
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v91/CreatePortfoliosTable.java
+++ b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v91/CreatePortfoliosTable.java
@@ -26,6 +26,7 @@ import org.sonar.server.platform.db.migration.step.CreateTableChange;
import static org.sonar.server.platform.db.migration.def.BigIntegerColumnDef.newBigIntegerColumnDefBuilder;
import static org.sonar.server.platform.db.migration.def.BooleanColumnDef.newBooleanColumnDefBuilder;
+import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.MAX_SIZE;
import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.UUID_SIZE;
import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.newVarcharColumnDefBuilder;
@@ -46,7 +47,7 @@ public class CreatePortfoliosTable extends CreateTableChange {
.addColumn(newVarcharColumnDefBuilder().setColumnName("parent_uuid").setIsNullable(true).setLimit(UUID_SIZE).build())
.addColumn(newBooleanColumnDefBuilder().setColumnName("private").setIsNullable(false).build())
.addColumn(newVarcharColumnDefBuilder().setColumnName("selection_mode").setIsNullable(false).setLimit(50).build())
- .addColumn(newVarcharColumnDefBuilder().setColumnName("selection_expression").setIsNullable(true).setLimit(50).build())
+ .addColumn(newVarcharColumnDefBuilder().setColumnName("selection_expression").setIsNullable(true).setLimit(MAX_SIZE).build())
.addColumn(newBigIntegerColumnDefBuilder().setColumnName("created_at").setIsNullable(false).build())
.addColumn(newBigIntegerColumnDefBuilder().setColumnName("updated_at").setIsNullable(false).build())
.build());
diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v91/CreatePortfoliosTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v91/CreatePortfoliosTableTest.java
index d7692207270..5f07bc51c91 100644
--- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v91/CreatePortfoliosTableTest.java
+++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v91/CreatePortfoliosTableTest.java
@@ -20,6 +20,7 @@
package org.sonar.server.platform.db.migration.version.v91;
import java.sql.SQLException;
+import java.sql.Types;
import org.junit.Rule;
import org.junit.Test;
import org.sonar.db.CoreDbTester;
@@ -47,9 +48,19 @@ public class CreatePortfoliosTableTest {
db.assertTableDoesNotExist(TABLE_NAME);
underTest.execute();
- //re-entrant
+ // re-entrant
underTest.execute();
db.assertTableExists(TABLE_NAME);
}
+
+ @Test
+ public void selection_expression_column_should_be_4000() throws SQLException {
+ db.assertTableDoesNotExist(TABLE_NAME);
+
+ underTest.execute();
+
+ db.assertTableExists(TABLE_NAME);
+ db.assertColumnDefinition(TABLE_NAME, "selection_expression", Types.VARCHAR, 4000, true);
+ }
}