diff options
author | Julien HENRY <julien.henry@sonarsource.com> | 2017-09-25 16:33:31 +0200 |
---|---|---|
committer | Julien HENRY <julien.henry@sonarsource.com> | 2017-09-27 14:50:52 +0200 |
commit | e7868aa03dc555ac4839d0a7c96c7708deb6d6de (patch) | |
tree | 392a2b901ebbabbdec5723b9707173d8ae758ccb /server/sonar-db-migration | |
parent | 489725dae8e137b669d596a9c9a53e86e6eee2ac (diff) | |
download | sonarqube-e7868aa03dc555ac4839d0a7c96c7708deb6d6de.tar.gz sonarqube-e7868aa03dc555ac4839d0a7c96c7708deb6d6de.zip |
SONAR-9575 Revert all changes made to support incremental mode
Diffstat (limited to 'server/sonar-db-migration')
4 files changed, 4 insertions, 109 deletions
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v66/AddIncrementalColumnToSnapshotsTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v66/AddIncrementalColumnToSnapshotsTable.java deleted file mode 100644 index 960626c0ccf..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v66/AddIncrementalColumnToSnapshotsTable.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2017 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.v66; - -import java.sql.SQLException; - -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.def.BooleanColumnDef; -import org.sonar.server.platform.db.migration.sql.AddColumnsBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -public class AddIncrementalColumnToSnapshotsTable extends DdlChange { - - public AddIncrementalColumnToSnapshotsTable(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new AddColumnsBuilder(getDialect(), "snapshots") - .addColumn(BooleanColumnDef.newBooleanColumnDefBuilder() - .setColumnName("incremental") - .setDefaultValue(false) - .build()) - .build()); - } - -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v66/DbVersion66.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v66/DbVersion66.java index e50531e123e..3bfe2ec422f 100644 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v66/DbVersion66.java +++ b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v66/DbVersion66.java @@ -27,7 +27,6 @@ public class DbVersion66 implements DbVersion { @Override public void addSteps(MigrationStepRegistry registry) { registry - .add(1800, "Add incremental column to snapshots table", AddIncrementalColumnToSnapshotsTable.class) .add(1801, "Create table CE task characteristics", CreateTableCeTaskCharacteristics.class) .add(1802, "Delete leak settings on views", DeleteLeakSettingsOnViews.class) .add(1803, "Fix empty USERS.EXTERNAL_IDENTITY and USERS.EXTERNAL_IDENTITY_PROVIDER", FixEmptyIdentityProviderInUsers.class) @@ -36,7 +35,6 @@ public class DbVersion66 implements DbVersion { .add(1806, "Create table project_branches", CreateTableProjectBranches.class) .add(1807, "Add on project_branches key", AddIndexOnProjectBranchesKey.class) .add(1808, "Add branch column to projects table", AddBranchColumnToProjectsTable.class) - .add(1809, "Populate project_branches with existing main branches", PopulateMainProjectBranches.class) - ; + .add(1809, "Populate project_branches with existing main branches", PopulateMainProjectBranches.class); } } diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v66/AddIncrementalColumnToSnapshotsTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v66/AddIncrementalColumnToSnapshotsTableTest.java deleted file mode 100644 index 0519ba270b7..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v66/AddIncrementalColumnToSnapshotsTableTest.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2017 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.v66; - -import java.sql.SQLException; -import java.sql.Types; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.ExpectedException; -import org.sonar.db.CoreDbTester; - -public class AddIncrementalColumnToSnapshotsTableTest { - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(AddIncrementalColumnToSnapshotsTableTest.class, "old_snapshots.sql"); - @Rule - public ExpectedException expectedException = ExpectedException.none(); - - private AddIncrementalColumnToSnapshotsTable underTest = new AddIncrementalColumnToSnapshotsTable(db.database()); - - @Test - public void migration_adds_column_to_empty_table() throws SQLException { - underTest.execute(); - - verifyAddedColumns(); - } - - @Test - public void migration_is_not_reentrant() throws SQLException { - underTest.execute(); - - expectedException.expect(IllegalStateException.class); - expectedException.expectMessage("Fail to execute "); - underTest.execute(); - } - - private void verifyAddedColumns() { - db.assertColumnDefinition("snapshots", "incremental", Types.BOOLEAN, null, true); - } - -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v66/DbVersion66Test.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v66/DbVersion66Test.java index 74fa9c04b6d..76a9365740c 100644 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v66/DbVersion66Test.java +++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v66/DbVersion66Test.java @@ -30,13 +30,13 @@ public class DbVersion66Test { private DbVersion66 underTest = new DbVersion66(); @Test - public void migrationNumber_starts_at_1800() { - verifyMinimumMigrationNumber(underTest, 1800); + public void migrationNumber_starts_at_1801() { + verifyMinimumMigrationNumber(underTest, 1801); } @Test public void verify_migration_count() { - verifyMigrationCount(underTest, 10); + verifyMigrationCount(underTest, 9); } } |