]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-7700 Decrease size of B VARCHAR columns in PROJECTS
authorSimon Brandhof <simon.brandhof@sonarsource.com>
Sun, 10 Jul 2016 22:40:33 +0000 (00:40 +0200)
committerSébastien Lesaint <sebastien.lesaint@sonarsource.com>
Mon, 11 Jul 2016 16:32:47 +0000 (18:32 +0200)
sonar-db/src/main/java/org/sonar/db/version/v60/AddBColumnsToProjects.java
sonar-db/src/main/java/org/sonar/db/version/v60/AddUuidPathColumnToProjects.java
sonar-db/src/main/java/org/sonar/db/version/v60/MakeUuidPathColumnNotNullOnProjects.java
sonar-db/src/main/resources/org/sonar/db/version/schema-h2.ddl
sonar-db/src/test/java/org/sonar/db/version/v60/AddBColumnsToProjectsTest.java

index 72af465d5b20b78872ffc347f891a3bc669f9368..630a776faf24b482f2e4a0a3106ef7c4cacc1942 100644 (file)
@@ -43,10 +43,10 @@ public class AddBColumnsToProjects extends DdlChange {
       .addColumn(newVarcharColumnDefBuilder().setColumnName("b_description").setLimit(2000).setIsNullable(true).build())
       .addColumn(newBooleanColumnDefBuilder().setColumnName("b_enabled").build())
       .addColumn(newVarcharColumnDefBuilder().setColumnName("b_language").setLimit(20).setIsNullable(true).build())
-      .addColumn(newVarcharColumnDefBuilder().setColumnName("b_long_name").setLimit(2000).setIsNullable(true).build())
+      .addColumn(newVarcharColumnDefBuilder().setColumnName("b_long_name").setLimit(500).setIsNullable(true).build())
       .addColumn(newVarcharColumnDefBuilder().setColumnName("b_module_uuid").setLimit(50).setIsNullable(true).build())
-      .addColumn(newVarcharColumnDefBuilder().setColumnName("b_module_uuid_path").setLimit(4000).setIsNullable(true).build())
-      .addColumn(newVarcharColumnDefBuilder().setColumnName("b_name").setLimit(2000).setIsNullable(true).build())
+      .addColumn(newVarcharColumnDefBuilder().setColumnName("b_module_uuid_path").setLimit(1500).setIsNullable(true).build())
+      .addColumn(newVarcharColumnDefBuilder().setColumnName("b_name").setLimit(500).setIsNullable(true).build())
       .addColumn(newVarcharColumnDefBuilder().setColumnName("b_path").setLimit(2000).setIsNullable(true).build())
       .addColumn(newVarcharColumnDefBuilder().setColumnName("b_qualifier").setLimit(3).setIsNullable(true).build())
       .build());
index b9a46741d8a6ea11e76901d8b840330f6aa0c097..fd0d4d8adaaedc541475aad2ec5bc4af9a7887cd 100644 (file)
@@ -24,7 +24,6 @@ import org.sonar.db.Database;
 import org.sonar.db.version.AddColumnsBuilder;
 import org.sonar.db.version.DdlChange;
 
-import static org.sonar.db.version.VarcharColumnDef.MAX_SIZE;
 import static org.sonar.db.version.VarcharColumnDef.newVarcharColumnDefBuilder;
 
 public class AddUuidPathColumnToProjects extends DdlChange {
@@ -38,7 +37,7 @@ public class AddUuidPathColumnToProjects extends DdlChange {
   @Override
   public void execute(Context context) throws SQLException {
     context.execute(new AddColumnsBuilder(getDialect(), TABLE_PROJECTS)
-      .addColumn(newVarcharColumnDefBuilder().setColumnName("uuid_path").setLimit(MAX_SIZE).setIsNullable(true).build())
+      .addColumn(newVarcharColumnDefBuilder().setColumnName("uuid_path").setLimit(1500).setIsNullable(true).build())
       .build());
   }
 
index bcb3ce4c7e03cc15d88cae92ddc0fc8b59f409e9..06b4578fc4e70ac1f57eebc1ecd3aa1302e1df2a 100644 (file)
@@ -24,7 +24,6 @@ import org.sonar.db.Database;
 import org.sonar.db.version.AlterColumnsBuilder;
 import org.sonar.db.version.DdlChange;
 
-import static org.sonar.db.version.VarcharColumnDef.MAX_SIZE;
 import static org.sonar.db.version.VarcharColumnDef.newVarcharColumnDefBuilder;
 
 public class MakeUuidPathColumnNotNullOnProjects extends DdlChange {
@@ -38,7 +37,7 @@ public class MakeUuidPathColumnNotNullOnProjects extends DdlChange {
   @Override
   public void execute(Context context) throws SQLException {
     context.execute(new AlterColumnsBuilder(getDialect(), TABLE_PROJECTS)
-      .updateColumn(newVarcharColumnDefBuilder().setColumnName("uuid_path").setLimit(MAX_SIZE).setIsNullable(false).build())
+      .updateColumn(newVarcharColumnDefBuilder().setColumnName("uuid_path").setLimit(1500).setIsNullable(false).build())
       .build());
   }
 
index 64c9fc7b99fb1a0020a1bace9c4fe281ffb5678c..724960533eb34a203c7ba9efdd0381e75d249bc7 100644 (file)
@@ -211,7 +211,7 @@ CREATE TABLE "PROJECTS" (
   "ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1),
   "KEE" VARCHAR(400),
   "UUID" VARCHAR(50) NOT NULL,
-  "UUID_PATH" VARCHAR(4000) NOT NULL,
+  "UUID_PATH" VARCHAR(1500) NOT NULL,
   "ROOT_UUID" VARCHAR(50) NOT NULL,
   "PROJECT_UUID" VARCHAR(50),
   "MODULE_UUID" VARCHAR(50),
@@ -234,10 +234,10 @@ CREATE TABLE "PROJECTS" (
   "B_DESCRIPTION" VARCHAR(2000),
   "B_ENABLED" BOOLEAN,
   "B_LANGUAGE" VARCHAR(20),
-  "B_LONG_NAME" VARCHAR(2000),
+  "B_LONG_NAME" VARCHAR(500),
   "B_MODULE_UUID" VARCHAR(50),
-  "B_MODULE_UUID_PATH" VARCHAR(4000),
-  "B_NAME" VARCHAR(2000),
+  "B_MODULE_UUID_PATH" VARCHAR(1500),
+  "B_NAME" VARCHAR(500),
   "B_PATH" VARCHAR(2000),
   "B_QUALIFIER" VARCHAR(3)
 );
index facb21de02d99b730ff7c1a6eddacbce17885a71..bb4cd65bf5b5c4ecfd704b1064ac901e870aad57 100644 (file)
@@ -81,10 +81,10 @@ public class AddBColumnsToProjectsTest {
     db.assertColumnDefinition(TABLE, "b_description", Types.VARCHAR, 2000, true);
     db.assertColumnDefinition(TABLE, "b_enabled", Types.BOOLEAN, null, true);
     db.assertColumnDefinition(TABLE, "b_language", Types.VARCHAR, 20, true);
+    db.assertColumnDefinition(TABLE, "b_long_name", Types.VARCHAR, 500, true);
     db.assertColumnDefinition(TABLE, "b_module_uuid", Types.VARCHAR, 50, true);
-    db.assertColumnDefinition(TABLE, "b_module_uuid_path", Types.VARCHAR, 4000, true);
-    db.assertColumnDefinition(TABLE, "b_name", Types.VARCHAR, 2000, true);
-    db.assertColumnDefinition(TABLE, "b_long_name", Types.VARCHAR, 2000, true);
+    db.assertColumnDefinition(TABLE, "b_module_uuid_path", Types.VARCHAR, 1500, true);
+    db.assertColumnDefinition(TABLE, "b_name", Types.VARCHAR, 500, true);
     db.assertColumnDefinition(TABLE, "b_path", Types.VARCHAR, 2000, true);
     db.assertColumnDefinition(TABLE, "b_qualifier", Types.VARCHAR, 3, true);
   }