]> source.dussan.org Git - sonarqube.git/commitdiff
move 9.7 DB migration to dedicated v97 subpackage
authorBenjamin Campomenosi <109955405+benjamin-campomenosi-sonarsource@users.noreply.github.com>
Tue, 20 Sep 2022 14:27:46 +0000 (16:27 +0200)
committersonartech <sonartech@sonarsource.com>
Tue, 20 Sep 2022 20:03:30 +0000 (20:03 +0000)
Co-authored-by: Antoine Vinot <antoine.vinot@sonarsource.com>
24 files changed:
server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/MigrationConfigurationModule.java
server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v96/AddWebhookSecretToAlmSettingsTable.java [deleted file]
server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v96/CreateUniqueIndexForComponentsUuid.java [deleted file]
server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v96/DbVersion96.java
server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v96/DropNonUniqueIndexForComponentsUuid.java [deleted file]
server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v97/AddWebhookSecretToAlmSettingsTable.java [new file with mode: 0644]
server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v97/CreateUniqueIndexForComponentsUuid.java [new file with mode: 0644]
server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v97/DbConstants.java [new file with mode: 0644]
server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v97/DbVersion97.java [new file with mode: 0644]
server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v97/DropNonUniqueIndexForComponentsUuid.java [new file with mode: 0644]
server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v97/package-info.java [new file with mode: 0644]
server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v96/AddWebhookSecretToAlmSettingsTableTest.java [deleted file]
server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v96/CreateUniqueIndexForComponentsUuidTest.java [deleted file]
server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v96/DropNonUniqueIndexForComponentsUuidTest.java [deleted file]
server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v97/AddWebhookSecretToAlmSettingsTableTest.java [new file with mode: 0644]
server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v97/CreateUniqueIndexForComponentsUuidTest.java [new file with mode: 0644]
server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v97/DbVersion97Test.java [new file with mode: 0644]
server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v97/DropNonUniqueIndexForComponentsUuidTest.java [new file with mode: 0644]
server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v96/AddWebhookSecretToAlmSettingsTableTest/schema.sql [deleted file]
server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v96/CreateUniqueIndexForComponentsUuidTest/schema.sql [deleted file]
server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v96/DropNonUniqueIndexForComponentsUuidTest/schema.sql [deleted file]
server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v97/AddWebhookSecretToAlmSettingsTableTest/schema.sql [new file with mode: 0644]
server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v97/CreateUniqueIndexForComponentsUuidTest/schema.sql [new file with mode: 0644]
server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v97/DropNonUniqueIndexForComponentsUuidTest/schema.sql [new file with mode: 0644]

index 8fdfebb70adee4d7d88bd8b6d45d0c1cf617f74e..d6481dcbe9d40ab339899f7ba568b28ff12fd287 100644 (file)
@@ -35,6 +35,7 @@ import org.sonar.server.platform.db.migration.version.v93.DbVersion93;
 import org.sonar.server.platform.db.migration.version.v94.DbVersion94;
 import org.sonar.server.platform.db.migration.version.v95.DbVersion95;
 import org.sonar.server.platform.db.migration.version.v96.DbVersion96;
+import org.sonar.server.platform.db.migration.version.v97.DbVersion97;
 
 public class MigrationConfigurationModule extends Module {
   @Override
@@ -50,6 +51,7 @@ public class MigrationConfigurationModule extends Module {
       DbVersion94.class,
       DbVersion95.class,
       DbVersion96.class,
+      DbVersion97.class,
 
       // migration steps
       MigrationStepRegistryImpl.class,
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v96/AddWebhookSecretToAlmSettingsTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v96/AddWebhookSecretToAlmSettingsTable.java
deleted file mode 100644 (file)
index 708abb1..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.v96;
-
-import com.google.common.annotations.VisibleForTesting;
-import java.sql.Connection;
-import java.sql.SQLException;
-import org.sonar.db.Database;
-import org.sonar.db.DatabaseUtils;
-import org.sonar.server.platform.db.migration.def.VarcharColumnDef;
-import org.sonar.server.platform.db.migration.sql.AddColumnsBuilder;
-import org.sonar.server.platform.db.migration.step.DdlChange;
-
-import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.newVarcharColumnDefBuilder;
-import static org.sonar.server.platform.db.migration.version.v96.DbConstants.WEBHOOK_SECRET_COLUMN_SIZE;
-
-public class AddWebhookSecretToAlmSettingsTable extends DdlChange {
-
-  @VisibleForTesting
-  static final String WEBHOOK_SECRET_COLUMN_NAME = "webhook_secret";
-  @VisibleForTesting
-  static final String ALM_SETTINGS_TABLE_NAME = "alm_settings";
-
-  private static final VarcharColumnDef COLUMN_DEFINITION = newVarcharColumnDefBuilder()
-    .setColumnName(WEBHOOK_SECRET_COLUMN_NAME)
-    .setIsNullable(true)
-    .setLimit(WEBHOOK_SECRET_COLUMN_SIZE).build();
-
-
-  public AddWebhookSecretToAlmSettingsTable(Database db) {
-    super(db);
-  }
-
-  @Override
-  public void execute(Context context) throws SQLException {
-    try (Connection connection = getDatabase().getDataSource().getConnection()) {
-      createWebhookSecretColumn(context, connection);
-    }
-  }
-
-  private void createWebhookSecretColumn(Context context, Connection connection) {
-    if (!DatabaseUtils.tableColumnExists(connection, ALM_SETTINGS_TABLE_NAME, WEBHOOK_SECRET_COLUMN_NAME)) {
-      context.execute(new AddColumnsBuilder(getDialect(), ALM_SETTINGS_TABLE_NAME)
-        .addColumn(COLUMN_DEFINITION)
-        .build());
-    }
-  }
-
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v96/CreateUniqueIndexForComponentsUuid.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v96/CreateUniqueIndexForComponentsUuid.java
deleted file mode 100644 (file)
index 9623d6b..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.v96;
-
-import com.google.common.annotations.VisibleForTesting;
-import java.sql.Connection;
-import java.sql.SQLException;
-import org.sonar.db.Database;
-import org.sonar.db.DatabaseUtils;
-import org.sonar.server.platform.db.migration.sql.CreateIndexBuilder;
-import org.sonar.server.platform.db.migration.step.DdlChange;
-
-public class CreateUniqueIndexForComponentsUuid extends DdlChange {
-
-  @VisibleForTesting
-  static final String COLUMN_NAME = "uuid";
-  @VisibleForTesting
-  static final String TABLE = "components";
-  @VisibleForTesting
-  static final String INDEX_NAME = "components_uuid";
-
-  public CreateUniqueIndexForComponentsUuid(Database db) {
-    super(db);
-  }
-
-  @Override
-  public void execute(Context context) throws SQLException {
-    try (Connection connection = getDatabase().getDataSource().getConnection()) {
-      createComponentsUuidUniqueIndex(context, connection);
-    }
-  }
-
-  private static void createComponentsUuidUniqueIndex(Context context, Connection connection) {
-    if (!DatabaseUtils.indexExistsIgnoreCase(TABLE, INDEX_NAME, connection)) {
-      context.execute(new CreateIndexBuilder()
-        .setTable(TABLE)
-        .setName(INDEX_NAME)
-        .addColumn(COLUMN_NAME)
-        .setUnique(true)
-        .build());
-    }
-  }
-}
index cd3e930d2db5a031523e96ae273dd74dc2bb700c..6352b8d059195faae443f07fd0ace87bb38b4c23 100644 (file)
@@ -43,9 +43,6 @@ public class DbVersion96 implements DbVersion {
       .add(6512, "Add column 'language' to 'push_events'", AddLanguageColumnToPushEventsTable.class)
       .add(6513, "Delete duplicated rows in 'project_badge_token'", DeleteDuplicatedProjectBadgeTokens.class)
       .add(6514, "Add unique index on 'project_uuid' in 'project_badge_token'", CreateIndexForProjectBadgeTokens.class)
-      .add(6515, "Add column 'webhook_secret' to 'alm_settings'", AddWebhookSecretToAlmSettingsTable.class)
-      .add(6516, "Drop non unique index on 'uuid' in 'components'", DropNonUniqueIndexForComponentsUuid.class)
-      .add(6517, "Add unique index on 'uuid' in 'components'", CreateUniqueIndexForComponentsUuid.class)
 
     ;
   }
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v96/DropNonUniqueIndexForComponentsUuid.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v96/DropNonUniqueIndexForComponentsUuid.java
deleted file mode 100644 (file)
index d29ec35..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.v96;
-
-import com.google.common.annotations.VisibleForTesting;
-import org.sonar.db.Database;
-import org.sonar.server.platform.db.migration.step.DropIndexChange;
-
-public class DropNonUniqueIndexForComponentsUuid extends DropIndexChange {
-
-  @VisibleForTesting
-  static final String TABLE = "components";
-  @VisibleForTesting
-  static final String INDEX_NAME = "projects_uuid";
-
-  public DropNonUniqueIndexForComponentsUuid(Database db) {
-    super(db, INDEX_NAME, TABLE);
-  }
-
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v97/AddWebhookSecretToAlmSettingsTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v97/AddWebhookSecretToAlmSettingsTable.java
new file mode 100644 (file)
index 0000000..8652ceb
--- /dev/null
@@ -0,0 +1,66 @@
+/*
+ * SonarQube
+ * Copyright (C) 2009-2022 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.v97;
+
+import com.google.common.annotations.VisibleForTesting;
+import java.sql.Connection;
+import java.sql.SQLException;
+import org.sonar.db.Database;
+import org.sonar.db.DatabaseUtils;
+import org.sonar.server.platform.db.migration.def.VarcharColumnDef;
+import org.sonar.server.platform.db.migration.sql.AddColumnsBuilder;
+import org.sonar.server.platform.db.migration.step.DdlChange;
+
+import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.newVarcharColumnDefBuilder;
+import static org.sonar.server.platform.db.migration.version.v97.DbConstants.WEBHOOK_SECRET_COLUMN_SIZE;
+
+public class AddWebhookSecretToAlmSettingsTable extends DdlChange {
+
+  @VisibleForTesting
+  static final String WEBHOOK_SECRET_COLUMN_NAME = "webhook_secret";
+  @VisibleForTesting
+  static final String ALM_SETTINGS_TABLE_NAME = "alm_settings";
+
+  private static final VarcharColumnDef COLUMN_DEFINITION = newVarcharColumnDefBuilder()
+    .setColumnName(WEBHOOK_SECRET_COLUMN_NAME)
+    .setIsNullable(true)
+    .setLimit(WEBHOOK_SECRET_COLUMN_SIZE).build();
+
+
+  public AddWebhookSecretToAlmSettingsTable(Database db) {
+    super(db);
+  }
+
+  @Override
+  public void execute(Context context) throws SQLException {
+    try (Connection connection = getDatabase().getDataSource().getConnection()) {
+      createWebhookSecretColumn(context, connection);
+    }
+  }
+
+  private void createWebhookSecretColumn(Context context, Connection connection) {
+    if (!DatabaseUtils.tableColumnExists(connection, ALM_SETTINGS_TABLE_NAME, WEBHOOK_SECRET_COLUMN_NAME)) {
+      context.execute(new AddColumnsBuilder(getDialect(), ALM_SETTINGS_TABLE_NAME)
+        .addColumn(COLUMN_DEFINITION)
+        .build());
+    }
+  }
+
+}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v97/CreateUniqueIndexForComponentsUuid.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v97/CreateUniqueIndexForComponentsUuid.java
new file mode 100644 (file)
index 0000000..292eee7
--- /dev/null
@@ -0,0 +1,60 @@
+/*
+ * SonarQube
+ * Copyright (C) 2009-2022 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.v97;
+
+import com.google.common.annotations.VisibleForTesting;
+import java.sql.Connection;
+import java.sql.SQLException;
+import org.sonar.db.Database;
+import org.sonar.db.DatabaseUtils;
+import org.sonar.server.platform.db.migration.sql.CreateIndexBuilder;
+import org.sonar.server.platform.db.migration.step.DdlChange;
+
+public class CreateUniqueIndexForComponentsUuid extends DdlChange {
+
+  @VisibleForTesting
+  static final String COLUMN_NAME = "uuid";
+  @VisibleForTesting
+  static final String TABLE = "components";
+  @VisibleForTesting
+  static final String INDEX_NAME = "components_uuid";
+
+  public CreateUniqueIndexForComponentsUuid(Database db) {
+    super(db);
+  }
+
+  @Override
+  public void execute(Context context) throws SQLException {
+    try (Connection connection = getDatabase().getDataSource().getConnection()) {
+      createComponentsUuidUniqueIndex(context, connection);
+    }
+  }
+
+  private static void createComponentsUuidUniqueIndex(Context context, Connection connection) {
+    if (!DatabaseUtils.indexExistsIgnoreCase(TABLE, INDEX_NAME, connection)) {
+      context.execute(new CreateIndexBuilder()
+        .setTable(TABLE)
+        .setName(INDEX_NAME)
+        .addColumn(COLUMN_NAME)
+        .setUnique(true)
+        .build());
+    }
+  }
+}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v97/DbConstants.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v97/DbConstants.java
new file mode 100644 (file)
index 0000000..8bf178b
--- /dev/null
@@ -0,0 +1,29 @@
+/*
+ * SonarQube
+ * Copyright (C) 2009-2022 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.v97;
+
+class DbConstants {
+  static final int CONTEXT_KEY_COLUMNS_SIZE = 50;
+  static final int WEBHOOK_SECRET_COLUMN_SIZE = 160;
+
+  private DbConstants() {
+    throw new IllegalStateException("This class must not be instantiated");
+  }
+}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v97/DbVersion97.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v97/DbVersion97.java
new file mode 100644 (file)
index 0000000..0234783
--- /dev/null
@@ -0,0 +1,34 @@
+/*
+ * SonarQube
+ * Copyright (C) 2009-2022 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.v97;
+
+import org.sonar.server.platform.db.migration.step.MigrationStepRegistry;
+import org.sonar.server.platform.db.migration.version.DbVersion;
+
+public class DbVersion97 implements DbVersion {
+  @Override
+  public void addSteps(MigrationStepRegistry registry) {
+    registry
+      .add(6600, "Add column 'webhook_secret' to 'alm_settings'", AddWebhookSecretToAlmSettingsTable.class)
+      .add(6601, "Drop non unique index on 'uuid' in 'components'", DropNonUniqueIndexForComponentsUuid.class)
+      .add(6602, "Add unique index on 'uuid' in 'components'", CreateUniqueIndexForComponentsUuid.class)
+    ;
+  }
+}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v97/DropNonUniqueIndexForComponentsUuid.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v97/DropNonUniqueIndexForComponentsUuid.java
new file mode 100644 (file)
index 0000000..552383c
--- /dev/null
@@ -0,0 +1,37 @@
+/*
+ * SonarQube
+ * Copyright (C) 2009-2022 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.v97;
+
+import com.google.common.annotations.VisibleForTesting;
+import org.sonar.db.Database;
+import org.sonar.server.platform.db.migration.step.DropIndexChange;
+
+public class DropNonUniqueIndexForComponentsUuid extends DropIndexChange {
+
+  @VisibleForTesting
+  static final String TABLE = "components";
+  @VisibleForTesting
+  static final String INDEX_NAME = "projects_uuid";
+
+  public DropNonUniqueIndexForComponentsUuid(Database db) {
+    super(db, INDEX_NAME, TABLE);
+  }
+
+}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v97/package-info.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v97/package-info.java
new file mode 100644 (file)
index 0000000..ccc15e9
--- /dev/null
@@ -0,0 +1,24 @@
+/*
+ * SonarQube
+ * Copyright (C) 2009-2022 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.
+ */
+@ParametersAreNonnullByDefault
+package org.sonar.server.platform.db.migration.version.v97;
+
+import javax.annotation.ParametersAreNonnullByDefault;
+
diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v96/AddWebhookSecretToAlmSettingsTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v96/AddWebhookSecretToAlmSettingsTableTest.java
deleted file mode 100644 (file)
index 536ec81..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.v96;
-
-import java.sql.SQLException;
-import java.sql.Types;
-import org.junit.Rule;
-import org.junit.Test;
-import org.sonar.db.CoreDbTester;
-
-import static org.sonar.db.CoreDbTester.createForSchema;
-import static org.sonar.server.platform.db.migration.version.v96.AddWebhookSecretToAlmSettingsTable.ALM_SETTINGS_TABLE_NAME;
-import static org.sonar.server.platform.db.migration.version.v96.AddWebhookSecretToAlmSettingsTable.WEBHOOK_SECRET_COLUMN_NAME;
-import static org.sonar.server.platform.db.migration.version.v96.DbConstants.WEBHOOK_SECRET_COLUMN_SIZE;
-
-public class AddWebhookSecretToAlmSettingsTableTest {
-
-  @Rule
-  public final CoreDbTester db = createForSchema(AddWebhookSecretToAlmSettingsTableTest.class, "schema.sql");
-
-  private final AddWebhookSecretToAlmSettingsTable underTest = new AddWebhookSecretToAlmSettingsTable(db.database());
-
-  @Test
-  public void column_language_should_be_added() throws SQLException {
-    db.assertColumnDoesNotExist(ALM_SETTINGS_TABLE_NAME, WEBHOOK_SECRET_COLUMN_NAME);
-
-    underTest.execute();
-
-    db.assertColumnDefinition(ALM_SETTINGS_TABLE_NAME, WEBHOOK_SECRET_COLUMN_NAME, Types.VARCHAR, WEBHOOK_SECRET_COLUMN_SIZE, true);
-  }
-
-  @Test
-  public void migration_should_be_reentrant() throws SQLException {
-    db.assertColumnDoesNotExist(ALM_SETTINGS_TABLE_NAME, WEBHOOK_SECRET_COLUMN_NAME);
-
-    underTest.execute();
-    underTest.execute();
-
-    db.assertColumnDefinition(ALM_SETTINGS_TABLE_NAME, WEBHOOK_SECRET_COLUMN_NAME, Types.VARCHAR, WEBHOOK_SECRET_COLUMN_SIZE, true);
-  }
-}
\ No newline at end of file
diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v96/CreateUniqueIndexForComponentsUuidTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v96/CreateUniqueIndexForComponentsUuidTest.java
deleted file mode 100644 (file)
index 9a587cb..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.v96;
-
-import java.sql.SQLException;
-import org.junit.Rule;
-import org.junit.Test;
-import org.sonar.db.CoreDbTester;
-
-import static org.sonar.server.platform.db.migration.version.v96.CreateUniqueIndexForComponentsUuid.COLUMN_NAME;
-import static org.sonar.server.platform.db.migration.version.v96.CreateUniqueIndexForComponentsUuid.INDEX_NAME;
-import static org.sonar.server.platform.db.migration.version.v96.CreateUniqueIndexForComponentsUuid.TABLE;
-
-public class CreateUniqueIndexForComponentsUuidTest {
-
-  @Rule
-  public final CoreDbTester db = CoreDbTester.createForSchema(CreateUniqueIndexForComponentsUuidTest.class, "schema.sql");
-
-  private final CreateUniqueIndexForComponentsUuid createUniqueIndexForComponentsUuid = new CreateUniqueIndexForComponentsUuid(db.database());
-
-  @Test
-  public void migration_should_create_index() throws SQLException {
-    db.assertIndexDoesNotExist(TABLE, INDEX_NAME);
-
-    createUniqueIndexForComponentsUuid.execute();
-
-    db.assertUniqueIndex(TABLE, INDEX_NAME, COLUMN_NAME);
-  }
-
-  @Test
-  public void migration_should_be_reentrant() throws SQLException {
-    db.assertIndexDoesNotExist(TABLE, INDEX_NAME);
-
-    createUniqueIndexForComponentsUuid.execute();
-    createUniqueIndexForComponentsUuid.execute();
-
-    db.assertUniqueIndex(TABLE, INDEX_NAME, COLUMN_NAME);
-  }
-
-
-}
\ No newline at end of file
diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v96/DropNonUniqueIndexForComponentsUuidTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v96/DropNonUniqueIndexForComponentsUuidTest.java
deleted file mode 100644 (file)
index bbc326c..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.v96;
-
-import java.sql.SQLException;
-import org.junit.Rule;
-import org.junit.Test;
-import org.sonar.db.CoreDbTester;
-
-import static org.sonar.server.platform.db.migration.version.v96.DropNonUniqueIndexForComponentsUuid.INDEX_NAME;
-import static org.sonar.server.platform.db.migration.version.v96.DropNonUniqueIndexForComponentsUuid.TABLE;
-
-public class DropNonUniqueIndexForComponentsUuidTest {
-
-  private static final String COLUMN_NAME = "uuid";
-  @Rule
-  public final CoreDbTester db = CoreDbTester.createForSchema(DropNonUniqueIndexForComponentsUuidTest.class, "schema.sql");
-
-  private final DropNonUniqueIndexForComponentsUuid dropNonUniqueIndexForComponentsUuid = new DropNonUniqueIndexForComponentsUuid(db.database());
-
-  @Test
-  public void migration_should_drop_unique_index() throws SQLException {
-    db.assertIndex(TABLE, INDEX_NAME, COLUMN_NAME);
-
-    dropNonUniqueIndexForComponentsUuid.execute();
-
-    db.assertIndexDoesNotExist(TABLE, INDEX_NAME);
-  }
-
-
-  @Test
-  public void migration_should_be_reentrant() throws SQLException {
-    db.assertIndex(TABLE, INDEX_NAME, COLUMN_NAME);
-
-    dropNonUniqueIndexForComponentsUuid.execute();
-    dropNonUniqueIndexForComponentsUuid.execute();
-
-    db.assertIndexDoesNotExist(TABLE, INDEX_NAME);
-  }
-
-}
\ No newline at end of file
diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v97/AddWebhookSecretToAlmSettingsTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v97/AddWebhookSecretToAlmSettingsTableTest.java
new file mode 100644 (file)
index 0000000..3c42451
--- /dev/null
@@ -0,0 +1,58 @@
+/*
+ * SonarQube
+ * Copyright (C) 2009-2022 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.v97;
+
+import java.sql.SQLException;
+import java.sql.Types;
+import org.junit.Rule;
+import org.junit.Test;
+import org.sonar.db.CoreDbTester;
+
+import static org.sonar.db.CoreDbTester.createForSchema;
+import static org.sonar.server.platform.db.migration.version.v97.AddWebhookSecretToAlmSettingsTable.ALM_SETTINGS_TABLE_NAME;
+import static org.sonar.server.platform.db.migration.version.v97.AddWebhookSecretToAlmSettingsTable.WEBHOOK_SECRET_COLUMN_NAME;
+import static org.sonar.server.platform.db.migration.version.v97.DbConstants.WEBHOOK_SECRET_COLUMN_SIZE;
+
+public class AddWebhookSecretToAlmSettingsTableTest {
+
+  @Rule
+  public final CoreDbTester db = createForSchema(AddWebhookSecretToAlmSettingsTableTest.class, "schema.sql");
+
+  private final AddWebhookSecretToAlmSettingsTable underTest = new AddWebhookSecretToAlmSettingsTable(db.database());
+
+  @Test
+  public void column_language_should_be_added() throws SQLException {
+    db.assertColumnDoesNotExist(ALM_SETTINGS_TABLE_NAME, WEBHOOK_SECRET_COLUMN_NAME);
+
+    underTest.execute();
+
+    db.assertColumnDefinition(ALM_SETTINGS_TABLE_NAME, WEBHOOK_SECRET_COLUMN_NAME, Types.VARCHAR, WEBHOOK_SECRET_COLUMN_SIZE, true);
+  }
+
+  @Test
+  public void migration_should_be_reentrant() throws SQLException {
+    db.assertColumnDoesNotExist(ALM_SETTINGS_TABLE_NAME, WEBHOOK_SECRET_COLUMN_NAME);
+
+    underTest.execute();
+    underTest.execute();
+
+    db.assertColumnDefinition(ALM_SETTINGS_TABLE_NAME, WEBHOOK_SECRET_COLUMN_NAME, Types.VARCHAR, WEBHOOK_SECRET_COLUMN_SIZE, true);
+  }
+}
diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v97/CreateUniqueIndexForComponentsUuidTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v97/CreateUniqueIndexForComponentsUuidTest.java
new file mode 100644 (file)
index 0000000..9b9867f
--- /dev/null
@@ -0,0 +1,58 @@
+/*
+ * SonarQube
+ * Copyright (C) 2009-2022 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.v97;
+
+import java.sql.SQLException;
+import org.junit.Rule;
+import org.junit.Test;
+import org.sonar.db.CoreDbTester;
+
+import static org.sonar.server.platform.db.migration.version.v97.CreateUniqueIndexForComponentsUuid.COLUMN_NAME;
+import static org.sonar.server.platform.db.migration.version.v97.CreateUniqueIndexForComponentsUuid.INDEX_NAME;
+import static org.sonar.server.platform.db.migration.version.v97.CreateUniqueIndexForComponentsUuid.TABLE;
+
+public class CreateUniqueIndexForComponentsUuidTest {
+
+  @Rule
+  public final CoreDbTester db = CoreDbTester.createForSchema(CreateUniqueIndexForComponentsUuidTest.class, "schema.sql");
+
+  private final CreateUniqueIndexForComponentsUuid createUniqueIndexForComponentsUuid = new CreateUniqueIndexForComponentsUuid(db.database());
+
+  @Test
+  public void migration_should_create_index() throws SQLException {
+    db.assertIndexDoesNotExist(TABLE, INDEX_NAME);
+
+    createUniqueIndexForComponentsUuid.execute();
+
+    db.assertUniqueIndex(TABLE, INDEX_NAME, COLUMN_NAME);
+  }
+
+  @Test
+  public void migration_should_be_reentrant() throws SQLException {
+    db.assertIndexDoesNotExist(TABLE, INDEX_NAME);
+
+    createUniqueIndexForComponentsUuid.execute();
+    createUniqueIndexForComponentsUuid.execute();
+
+    db.assertUniqueIndex(TABLE, INDEX_NAME, COLUMN_NAME);
+  }
+
+
+}
\ No newline at end of file
diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v97/DbVersion97Test.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v97/DbVersion97Test.java
new file mode 100644 (file)
index 0000000..003bb20
--- /dev/null
@@ -0,0 +1,41 @@
+/*
+ * SonarQube
+ * Copyright (C) 2009-2022 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.v97;
+
+import org.junit.Test;
+
+import static org.sonar.server.platform.db.migration.version.DbVersionTestUtils.verifyMigrationNotEmpty;
+import static org.sonar.server.platform.db.migration.version.DbVersionTestUtils.verifyMinimumMigrationNumber;
+
+public class DbVersion97Test {
+
+  private final DbVersion97 underTest = new DbVersion97();
+
+  @Test
+  public void migrationNumber_starts_at_6600() {
+    verifyMinimumMigrationNumber(underTest, 6600);
+  }
+
+  @Test
+  public void verify_migration_is_not_empty() {
+    verifyMigrationNotEmpty(underTest);
+  }
+
+}
\ No newline at end of file
diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v97/DropNonUniqueIndexForComponentsUuidTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v97/DropNonUniqueIndexForComponentsUuidTest.java
new file mode 100644 (file)
index 0000000..44d54bf
--- /dev/null
@@ -0,0 +1,58 @@
+/*
+ * SonarQube
+ * Copyright (C) 2009-2022 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.v97;
+
+import java.sql.SQLException;
+import org.junit.Rule;
+import org.junit.Test;
+import org.sonar.db.CoreDbTester;
+
+import static org.sonar.server.platform.db.migration.version.v97.DropNonUniqueIndexForComponentsUuid.INDEX_NAME;
+import static org.sonar.server.platform.db.migration.version.v97.DropNonUniqueIndexForComponentsUuid.TABLE;
+
+public class DropNonUniqueIndexForComponentsUuidTest {
+
+  private static final String COLUMN_NAME = "uuid";
+  @Rule
+  public final CoreDbTester db = CoreDbTester.createForSchema(DropNonUniqueIndexForComponentsUuidTest.class, "schema.sql");
+
+  private final DropNonUniqueIndexForComponentsUuid dropNonUniqueIndexForComponentsUuid = new DropNonUniqueIndexForComponentsUuid(db.database());
+
+  @Test
+  public void migration_should_drop_unique_index() throws SQLException {
+    db.assertIndex(TABLE, INDEX_NAME, COLUMN_NAME);
+
+    dropNonUniqueIndexForComponentsUuid.execute();
+
+    db.assertIndexDoesNotExist(TABLE, INDEX_NAME);
+  }
+
+
+  @Test
+  public void migration_should_be_reentrant() throws SQLException {
+    db.assertIndex(TABLE, INDEX_NAME, COLUMN_NAME);
+
+    dropNonUniqueIndexForComponentsUuid.execute();
+    dropNonUniqueIndexForComponentsUuid.execute();
+
+    db.assertIndexDoesNotExist(TABLE, INDEX_NAME);
+  }
+
+}
\ No newline at end of file
diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v96/AddWebhookSecretToAlmSettingsTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v96/AddWebhookSecretToAlmSettingsTableTest/schema.sql
deleted file mode 100644 (file)
index ac2de34..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-  CREATE TABLE "ALM_SETTINGS"(
-  "UUID" VARCHAR(40) NOT NULL,
-  "ALM_ID" VARCHAR(40) NOT NULL,
-  "KEE" VARCHAR(200) NOT NULL,
-  "URL" VARCHAR(2000),
-  "APP_ID" VARCHAR(80),
-  "PRIVATE_KEY" VARCHAR(2000),
-  "PAT" VARCHAR(2000),
-  "UPDATED_AT" BIGINT NOT NULL,
-  "CREATED_AT" BIGINT NOT NULL,
-  "CLIENT_ID" VARCHAR(80),
-  "CLIENT_SECRET" VARCHAR(80)
-  );
-  ALTER TABLE "ALM_SETTINGS" ADD CONSTRAINT "PK_ALM_SETTINGS" PRIMARY KEY("UUID");
-  CREATE UNIQUE INDEX "UNIQ_ALM_SETTINGS" ON "ALM_SETTINGS"("KEE");
\ No newline at end of file
diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v96/CreateUniqueIndexForComponentsUuidTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v96/CreateUniqueIndexForComponentsUuidTest/schema.sql
deleted file mode 100644 (file)
index 2d6834b..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-CREATE TABLE "COMPONENTS"(
-    "UUID" CHARACTER VARYING(50) NOT NULL,
-    "KEE" CHARACTER VARYING(1000),
-    "DEPRECATED_KEE" CHARACTER VARYING(400),
-    "NAME" CHARACTER VARYING(2000),
-    "LONG_NAME" CHARACTER VARYING(2000),
-    "DESCRIPTION" CHARACTER VARYING(2000),
-    "ENABLED" BOOLEAN DEFAULT TRUE NOT NULL,
-    "SCOPE" CHARACTER VARYING(3),
-    "QUALIFIER" CHARACTER VARYING(10),
-    "PRIVATE" BOOLEAN NOT NULL,
-    "ROOT_UUID" CHARACTER VARYING(50) NOT NULL,
-    "LANGUAGE" CHARACTER VARYING(20),
-    "COPY_COMPONENT_UUID" CHARACTER VARYING(50),
-    "PATH" CHARACTER VARYING(2000),
-    "UUID_PATH" CHARACTER VARYING(1500) NOT NULL,
-    "PROJECT_UUID" CHARACTER VARYING(50) NOT NULL,
-    "MODULE_UUID" CHARACTER VARYING(50),
-    "MODULE_UUID_PATH" CHARACTER VARYING(1500),
-    "MAIN_BRANCH_PROJECT_UUID" CHARACTER VARYING(50),
-    "B_CHANGED" BOOLEAN,
-    "B_NAME" CHARACTER VARYING(500),
-    "B_LONG_NAME" CHARACTER VARYING(500),
-    "B_DESCRIPTION" CHARACTER VARYING(2000),
-    "B_ENABLED" BOOLEAN,
-    "B_QUALIFIER" CHARACTER VARYING(10),
-    "B_LANGUAGE" CHARACTER VARYING(20),
-    "B_COPY_COMPONENT_UUID" CHARACTER VARYING(50),
-    "B_PATH" CHARACTER VARYING(2000),
-    "B_UUID_PATH" CHARACTER VARYING(1500),
-    "B_MODULE_UUID" CHARACTER VARYING(50),
-    "B_MODULE_UUID_PATH" CHARACTER VARYING(1500),
-    "CREATED_AT" TIMESTAMP
-);
-CREATE UNIQUE INDEX "PROJECTS_KEE" ON "COMPONENTS"("KEE" NULLS FIRST);
-CREATE INDEX "PROJECTS_MODULE_UUID" ON "COMPONENTS"("MODULE_UUID" NULLS FIRST);
-CREATE INDEX "PROJECTS_PROJECT_UUID" ON "COMPONENTS"("PROJECT_UUID" NULLS FIRST);
-CREATE INDEX "PROJECTS_QUALIFIER" ON "COMPONENTS"("QUALIFIER" NULLS FIRST);
-CREATE INDEX "PROJECTS_ROOT_UUID" ON "COMPONENTS"("ROOT_UUID" NULLS FIRST);
-CREATE INDEX "IDX_MAIN_BRANCH_PRJ_UUID" ON "COMPONENTS"("MAIN_BRANCH_PROJECT_UUID" NULLS FIRST);
\ No newline at end of file
diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v96/DropNonUniqueIndexForComponentsUuidTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v96/DropNonUniqueIndexForComponentsUuidTest/schema.sql
deleted file mode 100644 (file)
index 0fa3c25..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-CREATE TABLE "COMPONENTS"(
-    "UUID" CHARACTER VARYING(50) NOT NULL,
-    "KEE" CHARACTER VARYING(1000),
-    "DEPRECATED_KEE" CHARACTER VARYING(400),
-    "NAME" CHARACTER VARYING(2000),
-    "LONG_NAME" CHARACTER VARYING(2000),
-    "DESCRIPTION" CHARACTER VARYING(2000),
-    "ENABLED" BOOLEAN DEFAULT TRUE NOT NULL,
-    "SCOPE" CHARACTER VARYING(3),
-    "QUALIFIER" CHARACTER VARYING(10),
-    "PRIVATE" BOOLEAN NOT NULL,
-    "ROOT_UUID" CHARACTER VARYING(50) NOT NULL,
-    "LANGUAGE" CHARACTER VARYING(20),
-    "COPY_COMPONENT_UUID" CHARACTER VARYING(50),
-    "PATH" CHARACTER VARYING(2000),
-    "UUID_PATH" CHARACTER VARYING(1500) NOT NULL,
-    "PROJECT_UUID" CHARACTER VARYING(50) NOT NULL,
-    "MODULE_UUID" CHARACTER VARYING(50),
-    "MODULE_UUID_PATH" CHARACTER VARYING(1500),
-    "MAIN_BRANCH_PROJECT_UUID" CHARACTER VARYING(50),
-    "B_CHANGED" BOOLEAN,
-    "B_NAME" CHARACTER VARYING(500),
-    "B_LONG_NAME" CHARACTER VARYING(500),
-    "B_DESCRIPTION" CHARACTER VARYING(2000),
-    "B_ENABLED" BOOLEAN,
-    "B_QUALIFIER" CHARACTER VARYING(10),
-    "B_LANGUAGE" CHARACTER VARYING(20),
-    "B_COPY_COMPONENT_UUID" CHARACTER VARYING(50),
-    "B_PATH" CHARACTER VARYING(2000),
-    "B_UUID_PATH" CHARACTER VARYING(1500),
-    "B_MODULE_UUID" CHARACTER VARYING(50),
-    "B_MODULE_UUID_PATH" CHARACTER VARYING(1500),
-    "CREATED_AT" TIMESTAMP
-);
-CREATE UNIQUE INDEX "PROJECTS_KEE" ON "COMPONENTS"("KEE" NULLS FIRST);
-CREATE INDEX "PROJECTS_MODULE_UUID" ON "COMPONENTS"("MODULE_UUID" NULLS FIRST);
-CREATE INDEX "PROJECTS_PROJECT_UUID" ON "COMPONENTS"("PROJECT_UUID" NULLS FIRST);
-CREATE INDEX "PROJECTS_QUALIFIER" ON "COMPONENTS"("QUALIFIER" NULLS FIRST);
-CREATE INDEX "PROJECTS_ROOT_UUID" ON "COMPONENTS"("ROOT_UUID" NULLS FIRST);
-CREATE INDEX "PROJECTS_UUID" ON "COMPONENTS"("UUID" NULLS FIRST);
-CREATE INDEX "IDX_MAIN_BRANCH_PRJ_UUID" ON "COMPONENTS"("MAIN_BRANCH_PROJECT_UUID" NULLS FIRST);
\ No newline at end of file
diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v97/AddWebhookSecretToAlmSettingsTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v97/AddWebhookSecretToAlmSettingsTableTest/schema.sql
new file mode 100644 (file)
index 0000000..ac2de34
--- /dev/null
@@ -0,0 +1,15 @@
+  CREATE TABLE "ALM_SETTINGS"(
+  "UUID" VARCHAR(40) NOT NULL,
+  "ALM_ID" VARCHAR(40) NOT NULL,
+  "KEE" VARCHAR(200) NOT NULL,
+  "URL" VARCHAR(2000),
+  "APP_ID" VARCHAR(80),
+  "PRIVATE_KEY" VARCHAR(2000),
+  "PAT" VARCHAR(2000),
+  "UPDATED_AT" BIGINT NOT NULL,
+  "CREATED_AT" BIGINT NOT NULL,
+  "CLIENT_ID" VARCHAR(80),
+  "CLIENT_SECRET" VARCHAR(80)
+  );
+  ALTER TABLE "ALM_SETTINGS" ADD CONSTRAINT "PK_ALM_SETTINGS" PRIMARY KEY("UUID");
+  CREATE UNIQUE INDEX "UNIQ_ALM_SETTINGS" ON "ALM_SETTINGS"("KEE");
\ No newline at end of file
diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v97/CreateUniqueIndexForComponentsUuidTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v97/CreateUniqueIndexForComponentsUuidTest/schema.sql
new file mode 100644 (file)
index 0000000..2d6834b
--- /dev/null
@@ -0,0 +1,40 @@
+CREATE TABLE "COMPONENTS"(
+    "UUID" CHARACTER VARYING(50) NOT NULL,
+    "KEE" CHARACTER VARYING(1000),
+    "DEPRECATED_KEE" CHARACTER VARYING(400),
+    "NAME" CHARACTER VARYING(2000),
+    "LONG_NAME" CHARACTER VARYING(2000),
+    "DESCRIPTION" CHARACTER VARYING(2000),
+    "ENABLED" BOOLEAN DEFAULT TRUE NOT NULL,
+    "SCOPE" CHARACTER VARYING(3),
+    "QUALIFIER" CHARACTER VARYING(10),
+    "PRIVATE" BOOLEAN NOT NULL,
+    "ROOT_UUID" CHARACTER VARYING(50) NOT NULL,
+    "LANGUAGE" CHARACTER VARYING(20),
+    "COPY_COMPONENT_UUID" CHARACTER VARYING(50),
+    "PATH" CHARACTER VARYING(2000),
+    "UUID_PATH" CHARACTER VARYING(1500) NOT NULL,
+    "PROJECT_UUID" CHARACTER VARYING(50) NOT NULL,
+    "MODULE_UUID" CHARACTER VARYING(50),
+    "MODULE_UUID_PATH" CHARACTER VARYING(1500),
+    "MAIN_BRANCH_PROJECT_UUID" CHARACTER VARYING(50),
+    "B_CHANGED" BOOLEAN,
+    "B_NAME" CHARACTER VARYING(500),
+    "B_LONG_NAME" CHARACTER VARYING(500),
+    "B_DESCRIPTION" CHARACTER VARYING(2000),
+    "B_ENABLED" BOOLEAN,
+    "B_QUALIFIER" CHARACTER VARYING(10),
+    "B_LANGUAGE" CHARACTER VARYING(20),
+    "B_COPY_COMPONENT_UUID" CHARACTER VARYING(50),
+    "B_PATH" CHARACTER VARYING(2000),
+    "B_UUID_PATH" CHARACTER VARYING(1500),
+    "B_MODULE_UUID" CHARACTER VARYING(50),
+    "B_MODULE_UUID_PATH" CHARACTER VARYING(1500),
+    "CREATED_AT" TIMESTAMP
+);
+CREATE UNIQUE INDEX "PROJECTS_KEE" ON "COMPONENTS"("KEE" NULLS FIRST);
+CREATE INDEX "PROJECTS_MODULE_UUID" ON "COMPONENTS"("MODULE_UUID" NULLS FIRST);
+CREATE INDEX "PROJECTS_PROJECT_UUID" ON "COMPONENTS"("PROJECT_UUID" NULLS FIRST);
+CREATE INDEX "PROJECTS_QUALIFIER" ON "COMPONENTS"("QUALIFIER" NULLS FIRST);
+CREATE INDEX "PROJECTS_ROOT_UUID" ON "COMPONENTS"("ROOT_UUID" NULLS FIRST);
+CREATE INDEX "IDX_MAIN_BRANCH_PRJ_UUID" ON "COMPONENTS"("MAIN_BRANCH_PROJECT_UUID" NULLS FIRST);
\ No newline at end of file
diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v97/DropNonUniqueIndexForComponentsUuidTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v97/DropNonUniqueIndexForComponentsUuidTest/schema.sql
new file mode 100644 (file)
index 0000000..0fa3c25
--- /dev/null
@@ -0,0 +1,41 @@
+CREATE TABLE "COMPONENTS"(
+    "UUID" CHARACTER VARYING(50) NOT NULL,
+    "KEE" CHARACTER VARYING(1000),
+    "DEPRECATED_KEE" CHARACTER VARYING(400),
+    "NAME" CHARACTER VARYING(2000),
+    "LONG_NAME" CHARACTER VARYING(2000),
+    "DESCRIPTION" CHARACTER VARYING(2000),
+    "ENABLED" BOOLEAN DEFAULT TRUE NOT NULL,
+    "SCOPE" CHARACTER VARYING(3),
+    "QUALIFIER" CHARACTER VARYING(10),
+    "PRIVATE" BOOLEAN NOT NULL,
+    "ROOT_UUID" CHARACTER VARYING(50) NOT NULL,
+    "LANGUAGE" CHARACTER VARYING(20),
+    "COPY_COMPONENT_UUID" CHARACTER VARYING(50),
+    "PATH" CHARACTER VARYING(2000),
+    "UUID_PATH" CHARACTER VARYING(1500) NOT NULL,
+    "PROJECT_UUID" CHARACTER VARYING(50) NOT NULL,
+    "MODULE_UUID" CHARACTER VARYING(50),
+    "MODULE_UUID_PATH" CHARACTER VARYING(1500),
+    "MAIN_BRANCH_PROJECT_UUID" CHARACTER VARYING(50),
+    "B_CHANGED" BOOLEAN,
+    "B_NAME" CHARACTER VARYING(500),
+    "B_LONG_NAME" CHARACTER VARYING(500),
+    "B_DESCRIPTION" CHARACTER VARYING(2000),
+    "B_ENABLED" BOOLEAN,
+    "B_QUALIFIER" CHARACTER VARYING(10),
+    "B_LANGUAGE" CHARACTER VARYING(20),
+    "B_COPY_COMPONENT_UUID" CHARACTER VARYING(50),
+    "B_PATH" CHARACTER VARYING(2000),
+    "B_UUID_PATH" CHARACTER VARYING(1500),
+    "B_MODULE_UUID" CHARACTER VARYING(50),
+    "B_MODULE_UUID_PATH" CHARACTER VARYING(1500),
+    "CREATED_AT" TIMESTAMP
+);
+CREATE UNIQUE INDEX "PROJECTS_KEE" ON "COMPONENTS"("KEE" NULLS FIRST);
+CREATE INDEX "PROJECTS_MODULE_UUID" ON "COMPONENTS"("MODULE_UUID" NULLS FIRST);
+CREATE INDEX "PROJECTS_PROJECT_UUID" ON "COMPONENTS"("PROJECT_UUID" NULLS FIRST);
+CREATE INDEX "PROJECTS_QUALIFIER" ON "COMPONENTS"("QUALIFIER" NULLS FIRST);
+CREATE INDEX "PROJECTS_ROOT_UUID" ON "COMPONENTS"("ROOT_UUID" NULLS FIRST);
+CREATE INDEX "PROJECTS_UUID" ON "COMPONENTS"("UUID" NULLS FIRST);
+CREATE INDEX "IDX_MAIN_BRANCH_PRJ_UUID" ON "COMPONENTS"("MAIN_BRANCH_PROJECT_UUID" NULLS FIRST);
\ No newline at end of file