aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Brandhof <simon.brandhof@sonarsource.com>2017-08-30 11:51:04 +0200
committerSimon Brandhof <simon.brandhof@sonarsource.com>2017-09-07 22:03:32 +0200
commit931c34cc394b28e86e62f59b4017bb09133b6c65 (patch)
tree7bfc60ab780bf15c513a9f88d2f6b73be8ea524a
parent4000d244f77a2f99acfc8e8e58571ee13a8a6d77 (diff)
downloadsonarqube-931c34cc394b28e86e62f59b4017bb09133b6c65.tar.gz
sonarqube-931c34cc394b28e86e62f59b4017bb09133b6c65.zip
SONAR-9763 drop Oracle columns with SET UNUSED
-rw-r--r--server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/sql/DropColumnsBuilder.java18
-rw-r--r--server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/sql/DropColumnsBuilderTest.java2
2 files changed, 10 insertions, 10 deletions
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/sql/DropColumnsBuilder.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/sql/DropColumnsBuilder.java
index 4680aff0dd7..ac606967869 100644
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/sql/DropColumnsBuilder.java
+++ b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/sql/DropColumnsBuilder.java
@@ -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) {
diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/sql/DropColumnsBuilderTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/sql/DropColumnsBuilderTest.java
index d4b87df4531..ebc616507af 100644
--- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/sql/DropColumnsBuilderTest.java
+++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/sql/DropColumnsBuilderTest.java
@@ -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