]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-9763 drop Oracle columns with SET UNUSED
authorSimon Brandhof <simon.brandhof@sonarsource.com>
Wed, 30 Aug 2017 09:51:04 +0000 (11:51 +0200)
committerSimon Brandhof <simon.brandhof@sonarsource.com>
Thu, 7 Sep 2017 20:03:32 +0000 (22:03 +0200)
server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/sql/DropColumnsBuilder.java
server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/sql/DropColumnsBuilderTest.java

index 4680aff0dd7cae8d3812bb148df58d782071593a..ac606967869bb0a2b38b46c16c72ff4d8b0f49d3 100644 (file)
@@ -67,18 +67,18 @@ public class DropColumnsBuilder {
   }
 
   private String getOracleStatement() {
-    StringBuilder sql2 = new StringBuilder().append(ALTER_TABLE).append(tableName).append(" ");
-    sql2.append("DROP (");
-    dropColumns(sql2, "", columns);
-    sql2.append(")");
-    return sql2.toString();
+    StringBuilder sql = new StringBuilder().append(ALTER_TABLE).append(tableName).append(" ");
+    sql.append("SET UNUSED (");
+    dropColumns(sql, "", columns);
+    sql.append(")");
+    return sql.toString();
   }
 
   private String getMsSQLStatement(String... columnNames) {
-    StringBuilder sql1 = new StringBuilder().append(ALTER_TABLE).append(tableName).append(" ");
-    sql1.append("DROP COLUMN ");
-    dropColumns(sql1, "", columnNames);
-    return sql1.toString();
+    StringBuilder sql = new StringBuilder().append(ALTER_TABLE).append(tableName).append(" ");
+    sql.append("DROP COLUMN ");
+    dropColumns(sql, "", columnNames);
+    return sql.toString();
   }
 
   private static void dropColumns(StringBuilder sql, String columnPrefix, String... columnNames) {
index d4b87df453119faf7b369c2f9faa9020a793cede..ebc616507af87d746355a22a52c2a4ff4f570b72 100644 (file)
@@ -39,7 +39,7 @@ public class DropColumnsBuilderTest {
   @Test
   public void drop_columns_on_oracle() {
     assertThat(new DropColumnsBuilder(new Oracle(), "issues", "date_in_ms", "name").build())
-      .containsOnly("ALTER TABLE issues DROP (date_in_ms, name)");
+      .containsOnly("ALTER TABLE issues SET UNUSED (date_in_ms, name)");
   }
 
   @Test