+++ /dev/null
-/*
- * 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;
- }
-}
.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)
+++ /dev/null
-/*
- * 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");
- }
-}
+++ /dev/null
-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