]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-20058 simplify upgrade to 10.2 by removing index creation that is deleted later
authorPierre <pierre.guillot@sonarsource.com>
Wed, 30 Aug 2023 14:52:08 +0000 (16:52 +0200)
committersonartech <sonartech@sonarsource.com>
Thu, 31 Aug 2023 20:02:56 +0000 (20:02 +0000)
server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v102/CreateIndexProjectUuidInWebhookDeliveries.java [deleted file]
server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v102/DbVersion102.java
server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/CreateIndexProjectUuidInWebhookDeliveriesTest.java [deleted file]
server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v102/CreateIndexProjectUuidInWebhookDeliveriesTest/schema.sql [deleted file]

diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v102/CreateIndexProjectUuidInWebhookDeliveries.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v102/CreateIndexProjectUuidInWebhookDeliveries.java
deleted file mode 100644 (file)
index cadc8fa..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2023 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v102;
-
-import org.sonar.db.Database;
-import org.sonar.server.platform.db.migration.step.CreateIndexOnColumn;
-
-public class CreateIndexProjectUuidInWebhookDeliveries extends CreateIndexOnColumn {
-
-  private static final String TABLE_NAME = "webhook_deliveries";
-  private static final String COLUMN_NAME = "project_uuid";
-
-  public CreateIndexProjectUuidInWebhookDeliveries(Database db) {
-    super(db, TABLE_NAME, COLUMN_NAME, false);
-  }
-
-  /**
-   * There is a limit of 30 characters for index name, that's why this one has a different name
-   */
-  @Override
-  public String newIndexName() {
-    return "wd_" + COLUMN_NAME;
-  }
-}
index 66b80b60b0b81a3d01445f4796922c5becdbd029..d676fdd91c3996ec9828ad7ed634df0738bfe448 100644 (file)
@@ -65,7 +65,6 @@ public class DbVersion102 implements DbVersion {
 
       .add(10_2_015, "Drop index 'component_uuid' in 'webhook_deliveries' table", DropIndexComponentUuidInWebhookDeliveries.class)
       .add(10_2_016, "Rename 'component_uuid' in 'webhook_deliveries' table to 'project_uuid'", RenameComponentUuidInWebhookDeliveries.class)
-      .add(10_2_017, "Create index 'webhook_deliveries_project_uuid' in 'webhook_deliveries' table", CreateIndexProjectUuidInWebhookDeliveries.class)
 
       .add(10_2_018, "Drop index 'component_uuid' in 'snapshots' table", DropIndexComponentUuidInSnapshots.class)
       .add(10_2_019, "Rename 'component_uuid' in 'snapshots' table to 'root_component_uuid'", RenameComponentUuidInSnapshots.class)
diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/CreateIndexProjectUuidInWebhookDeliveriesTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/CreateIndexProjectUuidInWebhookDeliveriesTest.java
deleted file mode 100644 (file)
index 51f36d3..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2023 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v102;
-
-import java.sql.SQLException;
-import org.junit.Rule;
-import org.junit.Test;
-import org.sonar.db.CoreDbTester;
-
-public class CreateIndexProjectUuidInWebhookDeliveriesTest {
-  @Rule
-  public final CoreDbTester db = CoreDbTester.createForSchema(CreateIndexProjectUuidInWebhookDeliveriesTest.class, "schema.sql");
-
-  private final CreateIndexProjectUuidInWebhookDeliveries createIndex = new CreateIndexProjectUuidInWebhookDeliveries(db.database());
-
-  @Test
-  public void migration_should_create_index() throws SQLException {
-    db.assertIndexDoesNotExist("webhook_deliveries", "wd_project_uuid");
-
-    createIndex.execute();
-
-    db.assertIndex("webhook_deliveries", "wd_project_uuid", "project_uuid");
-  }
-
-  @Test
-  public void migration_should_be_reentrant() throws SQLException {
-    createIndex.execute();
-    createIndex.execute();
-
-    db.assertIndex("webhook_deliveries", "wd_project_uuid", "project_uuid");
-  }
-}
diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v102/CreateIndexProjectUuidInWebhookDeliveriesTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v102/CreateIndexProjectUuidInWebhookDeliveriesTest/schema.sql
deleted file mode 100644 (file)
index add1899..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-CREATE TABLE "WEBHOOK_DELIVERIES"(
-    "UUID" CHARACTER VARYING(40) NOT NULL,
-    "WEBHOOK_UUID" CHARACTER VARYING(40) NOT NULL,
-    "PROJECT_UUID" CHARACTER VARYING(40) NOT NULL,
-    "CE_TASK_UUID" CHARACTER VARYING(40),
-    "ANALYSIS_UUID" CHARACTER VARYING(40),
-    "NAME" CHARACTER VARYING(100) NOT NULL,
-    "URL" CHARACTER VARYING(2000) NOT NULL,
-    "SUCCESS" BOOLEAN NOT NULL,
-    "HTTP_STATUS" INTEGER,
-    "DURATION_MS" BIGINT NOT NULL,
-    "PAYLOAD" CHARACTER LARGE OBJECT NOT NULL,
-    "ERROR_STACKTRACE" CHARACTER LARGE OBJECT,
-    "CREATED_AT" BIGINT NOT NULL
-);
-ALTER TABLE "WEBHOOK_DELIVERIES" ADD CONSTRAINT "PK_WEBHOOK_DELIVERIES" PRIMARY KEY("UUID");
-CREATE INDEX "CE_TASK_UUID" ON "WEBHOOK_DELIVERIES"("CE_TASK_UUID" NULLS FIRST);
-CREATE INDEX "IDX_WBHK_DLVRS_WBHK_UUID" ON "WEBHOOK_DELIVERIES"("WEBHOOK_UUID" NULLS FIRST);
\ No newline at end of file