]> source.dussan.org Git - sonarqube.git/commitdiff
Revert "SONAR-19789 Add initial_perm_sync column to the projects table"
authorAntoine Vigneau <antoine.vigneau@sonarsource.com>
Mon, 7 Aug 2023 08:48:39 +0000 (10:48 +0200)
committersonartech <sonartech@sonarsource.com>
Mon, 7 Aug 2023 20:02:49 +0000 (20:02 +0000)
This reverts commit eee7644981d1fea2282256b01d57dedfceaf68b7.

server/sonar-db-dao/src/schema/schema-sq.ddl
server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v102/AddInitialPermSyncColumnInProjects.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/AddInitialPermSyncColumnInProjectsTest.java [deleted file]
server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v102/AddInitialPermSyncColumnInProjectsTest/schema.sql [deleted file]

index 476c29fae2ea872dd42870e7fda687b305070bcc..cdc4eb7f5c1045d723677eaf3c7dfb2fd4404cb2 100644 (file)
@@ -729,8 +729,7 @@ CREATE TABLE "PROJECTS"(
     "TAGS" CHARACTER VARYING(500),
     "CREATED_AT" BIGINT,
     "UPDATED_AT" BIGINT NOT NULL,
-    "NCLOC" BIGINT,
-    "INITIAL_PERM_SYNC" CHARACTER VARYING(40) DEFAULT 'NOT_APPLICABLE'
+    "NCLOC" BIGINT
 );
 ALTER TABLE "PROJECTS" ADD CONSTRAINT "PK_NEW_PROJECTS" PRIMARY KEY("UUID");
 CREATE UNIQUE INDEX "UNIQ_PROJECTS_KEE" ON "PROJECTS"("KEE" NULLS FIRST);
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v102/AddInitialPermSyncColumnInProjects.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v102/AddInitialPermSyncColumnInProjects.java
deleted file mode 100644 (file)
index b4fcb08..0000000
+++ /dev/null
@@ -1,54 +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.Connection;
-import java.sql.SQLException;
-import org.sonar.db.Database;
-import org.sonar.db.DatabaseUtils;
-import org.sonar.server.platform.db.migration.def.ColumnDef;
-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;
-
-public class AddInitialPermSyncColumnInProjects extends DdlChange {
-  private static final String TABLE_NAME = "projects";
-  private static final String COLUMN_NAME = "initial_perm_sync";
-  private static final int COLUMN_SIZE = 40;
-
-  public AddInitialPermSyncColumnInProjects(Database db) {
-    super(db);
-  }
-
-  @Override
-  public void execute(Context context) throws SQLException {
-    try (Connection connection = getDatabase().getDataSource().getConnection()) {
-      if (!DatabaseUtils.tableColumnExists(connection, TABLE_NAME, COLUMN_NAME)) {
-        ColumnDef columnDef = VarcharColumnDef.newVarcharColumnDefBuilder()
-          .setColumnName(COLUMN_NAME)
-          .setLimit(COLUMN_SIZE)
-          .setIsNullable(true)
-          .setDefaultValue("NOT_APPLICABLE")
-          .build();
-        context.execute(new AddColumnsBuilder(getDialect(), TABLE_NAME).addColumn(columnDef).build());
-      }
-    }
-  }
-}
index 0ed9ba34f145393602b65e247eb25d9ed11e649b..a9b3582ef4213dbe2c367158d17eb55c1bc37047 100644 (file)
@@ -85,8 +85,6 @@ public class DbVersion102 implements DbVersion {
       .add(10_2_030, "Create table 'anticipated_transitions'", CreateAnticipatedTransitionsTable.class)
 
       .add(10_2_031, "Increase size of 'ce_queue.is_last_key' from 55 to 80 characters", IncreaseIsLastKeyInCeActivity.class)
-      .add(10_2_032, "Increase size of 'ce_queue.main_is_last_key' from 55 to 80 characters", IncreaseMainIsLastKeyInCeActivity.class)
-
-      .add(10_2_033, "Add 'initial_perm_sync' column in 'projects' table", AddInitialPermSyncColumnInProjects.class);
+      .add(10_2_032, "Increase size of 'ce_queue.main_is_last_key' from 55 to 80 characters", IncreaseMainIsLastKeyInCeActivity.class);
   }
 }
diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/AddInitialPermSyncColumnInProjectsTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/AddInitialPermSyncColumnInProjectsTest.java
deleted file mode 100644 (file)
index 72457a2..0000000
+++ /dev/null
@@ -1,54 +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 java.sql.Types;
-import org.junit.Rule;
-import org.junit.Test;
-import org.sonar.db.CoreDbTester;
-
-public class AddInitialPermSyncColumnInProjectsTest {
-
-  private static final String TABLE_NAME = "projects";
-  private static final String COLUMN_NAME = "initial_perm_sync";
-  private static final int COLUMN_SIZE = 40;
-
-  @Rule
-  public final CoreDbTester db = CoreDbTester.createForSchema(AddInitialPermSyncColumnInProjectsTest.class, "schema.sql");
-
-  private final AddInitialPermSyncColumnInProjects underTest = new AddInitialPermSyncColumnInProjects(db.database());
-
-  @Test
-  public void execute_whenColumnDoesNotExist_shouldCreateColumn() throws SQLException {
-    db.assertColumnDoesNotExist(TABLE_NAME, COLUMN_NAME);
-    underTest.execute();
-    db.assertColumnDefinition(TABLE_NAME, COLUMN_NAME, Types.VARCHAR, COLUMN_SIZE, true);
-  }
-
-  @Test
-  public void execute_whenExecutedTwice_shouldNotFail() throws SQLException {
-    db.assertColumnDoesNotExist(TABLE_NAME, COLUMN_NAME);
-    underTest.execute();
-    underTest.execute();
-    db.assertColumnDefinition(TABLE_NAME, COLUMN_NAME, Types.VARCHAR, COLUMN_SIZE, true);
-  }
-
-}
\ No newline at end of file
diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v102/AddInitialPermSyncColumnInProjectsTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v102/AddInitialPermSyncColumnInProjectsTest/schema.sql
deleted file mode 100644 (file)
index 977fc34..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-CREATE TABLE "PROJECTS"(
-    "UUID" CHARACTER VARYING(40) NOT NULL,
-    "KEE" CHARACTER VARYING(400) NOT NULL,
-    "QUALIFIER" CHARACTER VARYING(10) NOT NULL,
-    "NAME" CHARACTER VARYING(2000),
-    "DESCRIPTION" CHARACTER VARYING(2000),
-    "PRIVATE" BOOLEAN NOT NULL,
-    "TAGS" CHARACTER VARYING(500),
-    "CREATED_AT" BIGINT,
-    "UPDATED_AT" BIGINT NOT NULL,
-    "NCLOC" BIGINT
-);
-ALTER TABLE "PROJECTS" ADD CONSTRAINT "PK_NEW_PROJECTS" PRIMARY KEY("UUID");
-CREATE UNIQUE INDEX "UNIQ_PROJECTS_KEE" ON "PROJECTS"("KEE" NULLS FIRST);
-CREATE INDEX "IDX_QUALIFIER" ON "PROJECTS"("QUALIFIER" NULLS FIRST);