]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-8025 rename columns DATA as they are reserved words
authorSébastien Lesaint <sebastien.lesaint@sonarsource.com>
Wed, 14 Sep 2016 13:58:11 +0000 (15:58 +0200)
committerSébastien Lesaint <sebastien.lesaint@sonarsource.com>
Fri, 16 Sep 2016 10:22:12 +0000 (12:22 +0200)
sonar-db/src/main/java/org/sonar/db/ce/CeScannerContextDao.java
sonar-db/src/main/java/org/sonar/db/ce/CeTaskInputDao.java
sonar-db/src/main/java/org/sonar/db/version/v61/CreateTableCeTaskInput.java
sonar-db/src/main/java/org/sonar/db/version/v61/CreateTableScannerContext.java
sonar-db/src/main/resources/org/sonar/db/version/schema-h2.ddl
sonar-db/src/test/java/org/sonar/db/version/v61/CreateTableCeTaskInputTest.java
sonar-db/src/test/java/org/sonar/db/version/v61/CreateTableScannerContextTest.java

index fd7dbdeec9f8f1c4a74e77a572bcdef6a763dbd4..6b62a1718d2ca12a56782fd4d3f4c9adbce889c7 100644 (file)
@@ -55,7 +55,7 @@ public class CeScannerContextDao implements Dao {
     long now = system.now();
     Connection connection = dbSession.getConnection();
     try (PreparedStatement stmt = connection.prepareStatement(
-        "INSERT INTO ce_scanner_context (task_uuid, created_at, updated_at, data) VALUES (?, ?, ?, ?)");
+        "INSERT INTO ce_scanner_context (task_uuid, created_at, updated_at, context_data) VALUES (?, ?, ?, ?)");
       InputStream inputStream = new LogsIteratorInputStream(scannerContextLines, UTF_8)) {
       stmt.setString(1, taskUuid);
       stmt.setLong(2, now);
@@ -73,7 +73,7 @@ public class CeScannerContextDao implements Dao {
    * whichever the platform SQ is running on ({@see LogsIteratorInputStream}).
    */
   public Optional<String> selectScannerContext(DbSession dbSession, String taskUuid) {
-    try (PreparedStatement stmt = dbSession.getConnection().prepareStatement("select data from ce_scanner_context where task_uuid=?")) {
+    try (PreparedStatement stmt = dbSession.getConnection().prepareStatement("select context_data from ce_scanner_context where task_uuid=?")) {
       stmt.setString(1, taskUuid);
       try (ResultSet rs = stmt.executeQuery()) {
         if (rs.next()) {
index ed418eed5f7b418a73b7c9edae0c588aa072187f..3654531f79159a383035a801eda9a07684d59a19 100644 (file)
@@ -45,7 +45,7 @@ public class CeTaskInputDao implements Dao {
     long now = system.now();
     Connection connection = dbSession.getConnection();
     try (PreparedStatement stmt = connection.prepareStatement(
-      "INSERT INTO ce_task_input (task_uuid, created_at, updated_at, data) VALUES (?, ?, ?, ?)")) {
+      "INSERT INTO ce_task_input (task_uuid, created_at, updated_at, input_data) VALUES (?, ?, ?, ?)")) {
       stmt.setString(1, taskUuid);
       stmt.setLong(2, now);
       stmt.setLong(3, now);
@@ -62,7 +62,7 @@ public class CeTaskInputDao implements Dao {
     ResultSet rs = null;
     DataStream result = null;
     try {
-      stmt = dbSession.getConnection().prepareStatement("SELECT data FROM ce_task_input WHERE task_uuid=? AND data IS NOT NULL");
+      stmt = dbSession.getConnection().prepareStatement("SELECT input_data FROM ce_task_input WHERE task_uuid=? AND input_data IS NOT NULL");
       stmt.setString(1, taskUuid);
       rs = stmt.executeQuery();
       if (rs.next()) {
index fc4d3ec13370d639fa644d8c8dbc0e60137f1913..1bcc1e13bc552f704e0069c005a393738d896f31 100644 (file)
@@ -39,7 +39,7 @@ public class CreateTableCeTaskInput extends DdlChange {
     context.execute(
       new CreateTableBuilder(getDialect(), "ce_task_input")
         .addPkColumn(newVarcharColumnDefBuilder().setColumnName("task_uuid").setLimit(UUID_SIZE).setIsNullable(false).build())
-        .addColumn(newBlobColumnDefBuilder().setColumnName("data").setIsNullable(true).build())
+        .addColumn(newBlobColumnDefBuilder().setColumnName("input_data").setIsNullable(true).build())
         .addColumn(newBigIntegerColumnDefBuilder().setColumnName("created_at").setIsNullable(false).build())
         .addColumn(newBigIntegerColumnDefBuilder().setColumnName("updated_at").setIsNullable(false).build())
         .build());
index 6d20e820c47ccc0a651b2ac69e0b512b95dc6243..57edc4a574c4dfe6ec191a937bad7abb2e816829 100644 (file)
@@ -39,7 +39,7 @@ public class CreateTableScannerContext extends DdlChange {
     context.execute(
       new CreateTableBuilder(getDialect(), "ce_scanner_context")
         .addPkColumn(newVarcharColumnDefBuilder().setColumnName("task_uuid").setLimit(UUID_SIZE).setIsNullable(false).build())
-        .addColumn(newBlobColumnDefBuilder().setColumnName("data").setIsNullable(false).build())
+        .addColumn(newBlobColumnDefBuilder().setColumnName("context_data").setIsNullable(false).build())
         .addColumn(newBigIntegerColumnDefBuilder().setColumnName("created_at").setIsNullable(false).build())
         .addColumn(newBigIntegerColumnDefBuilder().setColumnName("updated_at").setIsNullable(false).build())
         .build());
index 6b5b37e0aeb9284eec8fcf6e54ef3591f5d363f2..293743b8b8a8854d0a088acb27b51b2fdb207649 100644 (file)
@@ -552,14 +552,14 @@ CREATE TABLE "CE_ACTIVITY" (
 
 CREATE TABLE "CE_TASK_INPUT" (
   "TASK_UUID" VARCHAR(40) NOT NULL PRIMARY KEY,
-  "DATA" BLOB(167772150),
+  "INPUT_DATA" BLOB(167772150),
   "CREATED_AT" BIGINT NOT NULL,
   "UPDATED_AT" BIGINT NOT NULL
 );
 
 CREATE TABLE "CE_SCANNER_CONTEXT" (
   "TASK_UUID" VARCHAR(40) NOT NULL PRIMARY KEY,
-  "DATA" BLOB(167772150) NOT NULL,
+  "CONTEXT_DATA" BLOB(167772150) NOT NULL,
   "CREATED_AT" BIGINT NOT NULL,
   "UPDATED_AT" BIGINT NOT NULL
 );
index ff4d366d5c1cd3145f4d532a6618374a48d7d1ac..eb6d1dfd1a5661f9d3a300d33292673609c5d78e 100644 (file)
@@ -46,7 +46,7 @@ public class CreateTableCeTaskInputTest {
     assertThat(dbTester.countRowsOfTable(TABLE_CE_TASK_INPUT)).isEqualTo(0);
 
     dbTester.assertColumnDefinition(TABLE_CE_TASK_INPUT, "task_uuid", Types.VARCHAR, 40, false);
-    dbTester.assertColumnDefinition(TABLE_CE_TASK_INPUT, "data", Types.BLOB, null, true);
+    dbTester.assertColumnDefinition(TABLE_CE_TASK_INPUT, "input_data", Types.BLOB, null, true);
     dbTester.assertColumnDefinition(TABLE_CE_TASK_INPUT, "created_at", Types.BIGINT, null, false);
     dbTester.assertColumnDefinition(TABLE_CE_TASK_INPUT, "updated_at", Types.BIGINT, null, false);
     dbTester.assertPrimaryKey(TABLE_CE_TASK_INPUT, "pk_" + TABLE_CE_TASK_INPUT, "task_uuid");
index 97780fd4dfb79c388b28ab31d46ac78ead60d52e..0847efdae5d951c83786484d69e084dd29fd54fa 100644 (file)
@@ -46,7 +46,7 @@ public class CreateTableScannerContextTest {
     assertThat(dbTester.countRowsOfTable(TABLE_CE_SCANNER_CONTEXT)).isEqualTo(0);
 
     dbTester.assertColumnDefinition(TABLE_CE_SCANNER_CONTEXT, "task_uuid", Types.VARCHAR, 40, false);
-    dbTester.assertColumnDefinition(TABLE_CE_SCANNER_CONTEXT, "data", Types.BLOB, null, false);
+    dbTester.assertColumnDefinition(TABLE_CE_SCANNER_CONTEXT, "context_data", Types.BLOB, null, false);
     dbTester.assertColumnDefinition(TABLE_CE_SCANNER_CONTEXT, "created_at", Types.BIGINT, null, false);
     dbTester.assertColumnDefinition(TABLE_CE_SCANNER_CONTEXT, "updated_at", Types.BIGINT, null, false);
     dbTester.assertPrimaryKey(TABLE_CE_SCANNER_CONTEXT, "pk_" + TABLE_CE_SCANNER_CONTEXT, "task_uuid");