aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-db/src
diff options
context:
space:
mode:
authorSébastien Lesaint <sebastien.lesaint@sonarsource.com>2016-12-12 11:56:39 +0100
committerSébastien Lesaint <sebastien.lesaint@sonarsource.com>2016-12-14 12:11:53 +0100
commit4ff133235967c094e486f472c06ac2b625fbca90 (patch)
treec2530770601b6977076430271c3d8f295351f2c4 /sonar-db/src
parentd830b2989a51dba1207db5fcde182ce8a5ea22d4 (diff)
downloadsonarqube-4ff133235967c094e486f472c06ac2b625fbca90.tar.gz
sonarqube-4ff133235967c094e486f472c06ac2b625fbca90.zip
SONAR-8445 move SQ 6.1 migrations out of Ruby
Diffstat (limited to 'sonar-db/src')
-rw-r--r--sonar-db/src/main/java/org/sonar/db/version/MigrationStepModule.java40
-rw-r--r--sonar-db/src/main/java/org/sonar/db/version/v61/AddBUuidPathToProjects.java44
-rw-r--r--sonar-db/src/main/java/org/sonar/db/version/v61/AddErrorColumnsToCeActivity.java46
-rw-r--r--sonar-db/src/main/java/org/sonar/db/version/v61/CopyActivitiesToQprofileChanges.java68
-rw-r--r--sonar-db/src/main/java/org/sonar/db/version/v61/CreateTableCeTaskInput.java47
-rw-r--r--sonar-db/src/main/java/org/sonar/db/version/v61/CreateTableInternalProperties.java49
-rw-r--r--sonar-db/src/main/java/org/sonar/db/version/v61/CreateTableProperties2.java69
-rw-r--r--sonar-db/src/main/java/org/sonar/db/version/v61/CreateTableQprofileChanges.java49
-rw-r--r--sonar-db/src/main/java/org/sonar/db/version/v61/CreateTableRuleRepositories.java46
-rw-r--r--sonar-db/src/main/java/org/sonar/db/version/v61/CreateTableScannerContext.java47
-rw-r--r--sonar-db/src/main/java/org/sonar/db/version/v61/DeleteProjectDashboards.java75
-rw-r--r--sonar-db/src/main/java/org/sonar/db/version/v61/DeleteReportsFromCeQueue.java48
-rw-r--r--sonar-db/src/main/java/org/sonar/db/version/v61/DropIsGlobalFromDashboards.java41
-rw-r--r--sonar-db/src/main/java/org/sonar/db/version/v61/DropTableActivities.java46
-rw-r--r--sonar-db/src/main/java/org/sonar/db/version/v61/DropTableProperties.java46
-rw-r--r--sonar-db/src/main/java/org/sonar/db/version/v61/PopulateTableProperties2.java84
-rw-r--r--sonar-db/src/main/java/org/sonar/db/version/v61/RemoveViewsDefinitionFromProperties.java86
-rw-r--r--sonar-db/src/main/java/org/sonar/db/version/v61/RenameTableProperties2ToProperties.java56
-rw-r--r--sonar-db/src/main/java/org/sonar/db/version/v61/ShrinkModuleUuidPathOfProjects.java44
-rw-r--r--sonar-db/src/main/java/org/sonar/db/version/v61/package-info.java24
-rw-r--r--sonar-db/src/test/java/org/sonar/db/version/MigrationStepModuleTest.java2
-rw-r--r--sonar-db/src/test/java/org/sonar/db/version/v61/AddErrorColumnsToCeActivityTest.java87
-rw-r--r--sonar-db/src/test/java/org/sonar/db/version/v61/CopyActivitiesToQprofileChangesTest.java133
-rw-r--r--sonar-db/src/test/java/org/sonar/db/version/v61/CreateTableCeTaskInputTest.java63
-rw-r--r--sonar-db/src/test/java/org/sonar/db/version/v61/CreateTableInternalPropertiesTest.java65
-rw-r--r--sonar-db/src/test/java/org/sonar/db/version/v61/CreateTableProperties2Test.java68
-rw-r--r--sonar-db/src/test/java/org/sonar/db/version/v61/CreateTableQprofileChangesTest.java65
-rw-r--r--sonar-db/src/test/java/org/sonar/db/version/v61/CreateTableRuleRepositoriesTest.java63
-rw-r--r--sonar-db/src/test/java/org/sonar/db/version/v61/CreateTableScannerContextTest.java63
-rw-r--r--sonar-db/src/test/java/org/sonar/db/version/v61/DeleteProjectDashboardsTest.java141
-rw-r--r--sonar-db/src/test/java/org/sonar/db/version/v61/DeleteReportsFromCeQueueTest.java61
-rw-r--r--sonar-db/src/test/java/org/sonar/db/version/v61/DropIsGlobalFromDashboardsTest.java48
-rw-r--r--sonar-db/src/test/java/org/sonar/db/version/v61/PopulateTableProperties2Test.java406
-rw-r--r--sonar-db/src/test/java/org/sonar/db/version/v61/RemoveViewsDefinitionFromPropertiesTest.java97
-rw-r--r--sonar-db/src/test/resources/org/sonar/db/version/v61/AddErrorColumnsToCeActivityTest/old_ce_activity.sql17
-rw-r--r--sonar-db/src/test/resources/org/sonar/db/version/v61/CopyActivitiesToQprofileChangesTest/schema.sql22
-rw-r--r--sonar-db/src/test/resources/org/sonar/db/version/v61/CreateTableCeTaskInputTest/empty.sql0
-rw-r--r--sonar-db/src/test/resources/org/sonar/db/version/v61/CreateTableInternalPropertiesTest/empty.sql0
-rw-r--r--sonar-db/src/test/resources/org/sonar/db/version/v61/CreateTableProperties2Test/empty.sql0
-rw-r--r--sonar-db/src/test/resources/org/sonar/db/version/v61/CreateTableQprofileChangesTest/empty.sql0
-rw-r--r--sonar-db/src/test/resources/org/sonar/db/version/v61/CreateTableRuleRepositoriesTest/empty.sql0
-rw-r--r--sonar-db/src/test/resources/org/sonar/db/version/v61/DeleteProjectDashboardsTest/schema.sql39
-rw-r--r--sonar-db/src/test/resources/org/sonar/db/version/v61/DeleteReportsFromCeQueueTest/schema.sql11
-rw-r--r--sonar-db/src/test/resources/org/sonar/db/version/v61/PopulateTableProperties2Test/properties_and_properties_2_tables.sql20
-rw-r--r--sonar-db/src/test/resources/org/sonar/db/version/v61/RemoveViewsDefinitionFromPropertiesTest/properties_and_internal_properties.sql17
45 files changed, 2 insertions, 2541 deletions
diff --git a/sonar-db/src/main/java/org/sonar/db/version/MigrationStepModule.java b/sonar-db/src/main/java/org/sonar/db/version/MigrationStepModule.java
index e2720f1ce6f..160c60681b1 100644
--- a/sonar-db/src/main/java/org/sonar/db/version/MigrationStepModule.java
+++ b/sonar-db/src/main/java/org/sonar/db/version/MigrationStepModule.java
@@ -99,24 +99,6 @@ import org.sonar.db.version.v60.PopulateUuidPathColumnOnProjects;
import org.sonar.db.version.v60.RecreateIndexProjectsUuidFromProjects;
import org.sonar.db.version.v60.RemoveUsersPasswordWhenNotLocal;
import org.sonar.db.version.v60.TemporarilyDropIndexOfAnalysisUuidOnMeasures;
-import org.sonar.db.version.v61.AddBUuidPathToProjects;
-import org.sonar.db.version.v61.AddErrorColumnsToCeActivity;
-import org.sonar.db.version.v61.CopyActivitiesToQprofileChanges;
-import org.sonar.db.version.v61.CreateTableCeTaskInput;
-import org.sonar.db.version.v61.CreateTableInternalProperties;
-import org.sonar.db.version.v61.CreateTableProperties2;
-import org.sonar.db.version.v61.CreateTableQprofileChanges;
-import org.sonar.db.version.v61.CreateTableRuleRepositories;
-import org.sonar.db.version.v61.CreateTableScannerContext;
-import org.sonar.db.version.v61.DeleteProjectDashboards;
-import org.sonar.db.version.v61.DeleteReportsFromCeQueue;
-import org.sonar.db.version.v61.DropIsGlobalFromDashboards;
-import org.sonar.db.version.v61.DropTableActivities;
-import org.sonar.db.version.v61.DropTableProperties;
-import org.sonar.db.version.v61.PopulateTableProperties2;
-import org.sonar.db.version.v61.RemoveViewsDefinitionFromProperties;
-import org.sonar.db.version.v61.RenameTableProperties2ToProperties;
-import org.sonar.db.version.v61.ShrinkModuleUuidPathOfProjects;
public class MigrationStepModule extends Module {
@Override
@@ -220,26 +202,6 @@ public class MigrationStepModule extends Module {
DropIndexEventsSnapshotIdFromEvents.class,
TemporarilyDropIndexOfAnalysisUuidOnMeasures.class,
DropIndexOnSnapshotIdOfMeasures.class,
- DropIndicesOnTreeColumnsOfSnapshots.class,
-
- // 6.1
- DeleteProjectDashboards.class,
- DropIsGlobalFromDashboards.class,
- CreateTableCeTaskInput.class,
- DeleteReportsFromCeQueue.class,
- ShrinkModuleUuidPathOfProjects.class,
- AddBUuidPathToProjects.class,
- AddErrorColumnsToCeActivity.class,
- CreateTableScannerContext.class,
- CreateTableInternalProperties.class,
- CreateTableProperties2.class,
- PopulateTableProperties2.class,
- RemoveViewsDefinitionFromProperties.class,
- CreateTableQprofileChanges.class,
- CopyActivitiesToQprofileChanges.class,
- CreateTableRuleRepositories.class,
- DropTableActivities.class,
- DropTableProperties.class,
- RenameTableProperties2ToProperties.class);
+ DropIndicesOnTreeColumnsOfSnapshots.class);
}
}
diff --git a/sonar-db/src/main/java/org/sonar/db/version/v61/AddBUuidPathToProjects.java b/sonar-db/src/main/java/org/sonar/db/version/v61/AddBUuidPathToProjects.java
deleted file mode 100644
index 180d34e3fa8..00000000000
--- a/sonar-db/src/main/java/org/sonar/db/version/v61/AddBUuidPathToProjects.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2016 SonarSource SA
- * mailto:contact 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.db.version.v61;
-
-import java.sql.SQLException;
-import org.sonar.db.Database;
-import org.sonar.db.version.AddColumnsBuilder;
-import org.sonar.db.version.DdlChange;
-
-import static org.sonar.db.version.VarcharColumnDef.newVarcharColumnDefBuilder;
-
-public class AddBUuidPathToProjects extends DdlChange {
-
- private static final String TABLE_PROJECTS = "projects";
-
- public AddBUuidPathToProjects(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- context.execute(new AddColumnsBuilder(getDatabase().getDialect(), TABLE_PROJECTS)
- .addColumn(newVarcharColumnDefBuilder().setColumnName("b_uuid_path").setLimit(1500).setIgnoreOracleUnit(true).build())
- .build());
- }
-
-}
diff --git a/sonar-db/src/main/java/org/sonar/db/version/v61/AddErrorColumnsToCeActivity.java b/sonar-db/src/main/java/org/sonar/db/version/v61/AddErrorColumnsToCeActivity.java
deleted file mode 100644
index c6fc589368c..00000000000
--- a/sonar-db/src/main/java/org/sonar/db/version/v61/AddErrorColumnsToCeActivity.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2016 SonarSource SA
- * mailto:contact 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.db.version.v61;
-
-import java.sql.SQLException;
-import org.sonar.db.Database;
-import org.sonar.db.version.AddColumnsBuilder;
-import org.sonar.db.version.DdlChange;
-
-import static org.sonar.db.version.ClobColumnDef.newClobColumnDefBuilder;
-import static org.sonar.db.version.VarcharColumnDef.newVarcharColumnDefBuilder;
-
-public class AddErrorColumnsToCeActivity extends DdlChange {
-
- private static final String TABLE_CE_ACTIVITY = "ce_activity";
-
- public AddErrorColumnsToCeActivity(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- context.execute(new AddColumnsBuilder(getDatabase().getDialect(), TABLE_CE_ACTIVITY)
- .addColumn(newVarcharColumnDefBuilder().setColumnName("error_message").setLimit(1000).setIgnoreOracleUnit(true).build())
- .addColumn(newClobColumnDefBuilder().setColumnName("error_stacktrace").setIsNullable(true).build())
- .build());
- }
-
-}
diff --git a/sonar-db/src/main/java/org/sonar/db/version/v61/CopyActivitiesToQprofileChanges.java b/sonar-db/src/main/java/org/sonar/db/version/v61/CopyActivitiesToQprofileChanges.java
deleted file mode 100644
index fe863cd629c..00000000000
--- a/sonar-db/src/main/java/org/sonar/db/version/v61/CopyActivitiesToQprofileChanges.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2016 SonarSource SA
- * mailto:contact 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.db.version.v61;
-
-import java.sql.SQLException;
-import java.util.Date;
-import org.sonar.db.Database;
-import org.sonar.db.version.BaseDataChange;
-import org.sonar.db.version.MassUpdate;
-
-public class CopyActivitiesToQprofileChanges extends BaseDataChange {
-
- public CopyActivitiesToQprofileChanges(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- MassUpdate massUpdate = context.prepareMassUpdate();
- massUpdate.rowPluralName("activities");
- massUpdate
- .select("select a.log_key, a.profile_key, a.created_at, a.user_login, a.log_action, a.data_field " +
- "from activities a " +
- "left join qprofile_changes qc on qc.kee = a.log_key " +
- "where a.log_type=? " +
- "and a.log_action is not null " +
- "and a.profile_key is not null " +
- "and a.created_at is not null " +
- "and qc.kee is null")
- .setString(1, "QPROFILE");
-
- massUpdate.update("insert into qprofile_changes (kee, qprofile_key, created_at, user_login, change_type, change_data) values (?,?,?,?,?,?)");
- massUpdate.execute((row, update) -> {
- String key = row.getString(1);
- String profileKey = row.getString(2);
- Date createdAt = row.getDate(3);
- String login = row.getNullableString(4);
- String type = row.getString(5);
- String data = row.getNullableString(6);
-
- update.setString(1, key);
- update.setString(2, profileKey);
- update.setLong(3, createdAt.getTime());
- update.setString(4, login);
- update.setString(5, type);
- update.setString(6, data);
- return true;
- });
- }
-
-}
diff --git a/sonar-db/src/main/java/org/sonar/db/version/v61/CreateTableCeTaskInput.java b/sonar-db/src/main/java/org/sonar/db/version/v61/CreateTableCeTaskInput.java
deleted file mode 100644
index c701891b5a2..00000000000
--- a/sonar-db/src/main/java/org/sonar/db/version/v61/CreateTableCeTaskInput.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2016 SonarSource SA
- * mailto:contact 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.db.version.v61;
-
-import java.sql.SQLException;
-import org.sonar.db.Database;
-import org.sonar.db.version.CreateTableBuilder;
-import org.sonar.db.version.DdlChange;
-
-import static org.sonar.db.version.BigIntegerColumnDef.newBigIntegerColumnDefBuilder;
-import static org.sonar.db.version.BlobColumnDef.newBlobColumnDefBuilder;
-import static org.sonar.db.version.VarcharColumnDef.UUID_SIZE;
-import static org.sonar.db.version.VarcharColumnDef.newVarcharColumnDefBuilder;
-
-public class CreateTableCeTaskInput extends DdlChange {
- public CreateTableCeTaskInput(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- context.execute(
- new CreateTableBuilder(getDialect(), "ce_task_input")
- .addPkColumn(newVarcharColumnDefBuilder().setColumnName("task_uuid").setLimit(UUID_SIZE).setIsNullable(false).setIgnoreOracleUnit(true).build())
- .addColumn(newBlobColumnDefBuilder().setColumnName("input_data").setIsNullable(true).build())
- .addColumn(newBigIntegerColumnDefBuilder().setColumnName("created_at").setIsNullable(false).build())
- .addColumn(newBigIntegerColumnDefBuilder().setColumnName("updated_at").setIsNullable(false).build())
- .build());
- }
-}
diff --git a/sonar-db/src/main/java/org/sonar/db/version/v61/CreateTableInternalProperties.java b/sonar-db/src/main/java/org/sonar/db/version/v61/CreateTableInternalProperties.java
deleted file mode 100644
index 35fa6c4a85c..00000000000
--- a/sonar-db/src/main/java/org/sonar/db/version/v61/CreateTableInternalProperties.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2016 SonarSource SA
- * mailto:contact 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.db.version.v61;
-
-import java.sql.SQLException;
-import org.sonar.db.Database;
-import org.sonar.db.version.CreateTableBuilder;
-import org.sonar.db.version.DdlChange;
-
-import static org.sonar.db.version.BigIntegerColumnDef.newBigIntegerColumnDefBuilder;
-import static org.sonar.db.version.BooleanColumnDef.newBooleanColumnDefBuilder;
-import static org.sonar.db.version.ClobColumnDef.newClobColumnDefBuilder;
-import static org.sonar.db.version.VarcharColumnDef.MAX_SIZE;
-import static org.sonar.db.version.VarcharColumnDef.newVarcharColumnDefBuilder;
-
-public class CreateTableInternalProperties extends DdlChange {
- public CreateTableInternalProperties(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- context.execute(
- new CreateTableBuilder(getDialect(), "internal_properties")
- .addPkColumn(newVarcharColumnDefBuilder().setColumnName("kee").setLimit(20).setIsNullable(false).setIgnoreOracleUnit(true).build())
- .addColumn(newBooleanColumnDefBuilder().setColumnName("is_empty").setIsNullable(false).build())
- .addColumn(newVarcharColumnDefBuilder().setColumnName("text_value").setLimit(MAX_SIZE).setIgnoreOracleUnit(true).build())
- .addColumn(newClobColumnDefBuilder().setColumnName("clob_value").setIsNullable(true).build())
- .addColumn(newBigIntegerColumnDefBuilder().setColumnName("created_at").setIsNullable(false).build())
- .build());
- }
-}
diff --git a/sonar-db/src/main/java/org/sonar/db/version/v61/CreateTableProperties2.java b/sonar-db/src/main/java/org/sonar/db/version/v61/CreateTableProperties2.java
deleted file mode 100644
index ee982287728..00000000000
--- a/sonar-db/src/main/java/org/sonar/db/version/v61/CreateTableProperties2.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2016 SonarSource SA
- * mailto:contact 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.db.version.v61;
-
-import java.sql.SQLException;
-import java.util.List;
-import org.sonar.db.Database;
-import org.sonar.db.version.CreateIndexBuilder;
-import org.sonar.db.version.CreateTableBuilder;
-import org.sonar.db.version.DdlChange;
-import org.sonar.db.version.VarcharColumnDef;
-
-import static org.sonar.db.version.BigIntegerColumnDef.newBigIntegerColumnDefBuilder;
-import static org.sonar.db.version.BooleanColumnDef.newBooleanColumnDefBuilder;
-import static org.sonar.db.version.ClobColumnDef.newClobColumnDefBuilder;
-import static org.sonar.db.version.CreateTableBuilder.ColumnFlag.AUTO_INCREMENT;
-import static org.sonar.db.version.IntegerColumnDef.newIntegerColumnDefBuilder;
-import static org.sonar.db.version.VarcharColumnDef.MAX_SIZE;
-import static org.sonar.db.version.VarcharColumnDef.newVarcharColumnDefBuilder;
-
-public class CreateTableProperties2 extends DdlChange {
-
- private static final String TABLE_NAME = "properties2";
-
- public CreateTableProperties2(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- VarcharColumnDef propKey = newVarcharColumnDefBuilder().setColumnName("prop_key").setLimit(512).setIsNullable(false).setIgnoreOracleUnit(true).build();
- List<String> stmts = new CreateTableBuilder(getDialect(), TABLE_NAME)
- .addPkColumn(newIntegerColumnDefBuilder().setColumnName("id").setIsNullable(false).build(), AUTO_INCREMENT)
- .addColumn(propKey)
- .addColumn(newBigIntegerColumnDefBuilder().setColumnName("resource_id").setIsNullable(true).build())
- .addColumn(newBigIntegerColumnDefBuilder().setColumnName("user_id").setIsNullable(true).build())
- .addColumn(newBooleanColumnDefBuilder().setColumnName("is_empty").setIsNullable(false).build())
- .addColumn(newVarcharColumnDefBuilder().setColumnName("text_value").setLimit(MAX_SIZE).setIgnoreOracleUnit(true).build())
- .addColumn(newClobColumnDefBuilder().setColumnName("clob_value").setIsNullable(true).build())
- .addColumn(newBigIntegerColumnDefBuilder().setColumnName("created_at").setIsNullable(false).build())
- // table with be renamed to properties in following migration, use final constraint name right away
- .withPkConstraintName("pk_properties")
- .build();
- context.execute(stmts);
-
- context.execute(new CreateIndexBuilder(getDialect())
- .setTable(TABLE_NAME)
- .setName("properties2_key")
- .addColumn(propKey)
- .build());
- }
-}
diff --git a/sonar-db/src/main/java/org/sonar/db/version/v61/CreateTableQprofileChanges.java b/sonar-db/src/main/java/org/sonar/db/version/v61/CreateTableQprofileChanges.java
deleted file mode 100644
index 0ef9106f5e5..00000000000
--- a/sonar-db/src/main/java/org/sonar/db/version/v61/CreateTableQprofileChanges.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2016 SonarSource SA
- * mailto:contact 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.db.version.v61;
-
-import java.sql.SQLException;
-import java.util.List;
-import org.sonar.db.Database;
-import org.sonar.db.version.CreateTableBuilder;
-import org.sonar.db.version.DdlChange;
-
-import static org.sonar.db.version.BigIntegerColumnDef.newBigIntegerColumnDefBuilder;
-import static org.sonar.db.version.ClobColumnDef.newClobColumnDefBuilder;
-import static org.sonar.db.version.VarcharColumnDef.newVarcharColumnDefBuilder;
-
-public class CreateTableQprofileChanges extends DdlChange {
- public CreateTableQprofileChanges(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- List<String> stmts = new CreateTableBuilder(getDialect(), "qprofile_changes")
- .addPkColumn(newVarcharColumnDefBuilder().setColumnName("kee").setLimit(40).setIsNullable(false).setIgnoreOracleUnit(true).build())
- .addColumn(newVarcharColumnDefBuilder().setColumnName("qprofile_key").setLimit(255).setIsNullable(false).setIgnoreOracleUnit(true).build())
- .addColumn(newVarcharColumnDefBuilder().setColumnName("change_type").setLimit(20).setIsNullable(false).setIgnoreOracleUnit(true).build())
- .addColumn(newVarcharColumnDefBuilder().setColumnName("user_login").setLimit(255).setIsNullable(true).setIgnoreOracleUnit(true).build())
- .addColumn(newClobColumnDefBuilder().setColumnName("change_data").setIsNullable(true).build())
- .addColumn(newBigIntegerColumnDefBuilder().setColumnName("created_at").setIsNullable(false).build())
- .build();
- context.execute(stmts);
- }
-}
diff --git a/sonar-db/src/main/java/org/sonar/db/version/v61/CreateTableRuleRepositories.java b/sonar-db/src/main/java/org/sonar/db/version/v61/CreateTableRuleRepositories.java
deleted file mode 100644
index 619c7289c11..00000000000
--- a/sonar-db/src/main/java/org/sonar/db/version/v61/CreateTableRuleRepositories.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2016 SonarSource SA
- * mailto:contact 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.db.version.v61;
-
-import java.sql.SQLException;
-import java.util.List;
-import org.sonar.db.Database;
-import org.sonar.db.version.CreateTableBuilder;
-import org.sonar.db.version.DdlChange;
-
-import static org.sonar.db.version.BigIntegerColumnDef.newBigIntegerColumnDefBuilder;
-import static org.sonar.db.version.VarcharColumnDef.newVarcharColumnDefBuilder;
-
-public class CreateTableRuleRepositories extends DdlChange {
- public CreateTableRuleRepositories(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- List<String> stmts = new CreateTableBuilder(getDialect(), "rule_repositories")
- .addPkColumn(newVarcharColumnDefBuilder().setColumnName("kee").setLimit(200).setIsNullable(false).setIgnoreOracleUnit(true).build())
- .addColumn(newVarcharColumnDefBuilder().setColumnName("language").setLimit(20).setIsNullable(false).setIgnoreOracleUnit(true).build())
- .addColumn(newVarcharColumnDefBuilder().setColumnName("name").setLimit(4000).setIsNullable(false).setIgnoreOracleUnit(true).build())
- .addColumn(newBigIntegerColumnDefBuilder().setColumnName("created_at").setIsNullable(false).build())
- .build();
- context.execute(stmts);
- }
-}
diff --git a/sonar-db/src/main/java/org/sonar/db/version/v61/CreateTableScannerContext.java b/sonar-db/src/main/java/org/sonar/db/version/v61/CreateTableScannerContext.java
deleted file mode 100644
index 7c6f1f08897..00000000000
--- a/sonar-db/src/main/java/org/sonar/db/version/v61/CreateTableScannerContext.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2016 SonarSource SA
- * mailto:contact 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.db.version.v61;
-
-import java.sql.SQLException;
-import org.sonar.db.Database;
-import org.sonar.db.version.CreateTableBuilder;
-import org.sonar.db.version.DdlChange;
-
-import static org.sonar.db.version.BigIntegerColumnDef.newBigIntegerColumnDefBuilder;
-import static org.sonar.db.version.BlobColumnDef.newBlobColumnDefBuilder;
-import static org.sonar.db.version.VarcharColumnDef.UUID_SIZE;
-import static org.sonar.db.version.VarcharColumnDef.newVarcharColumnDefBuilder;
-
-public class CreateTableScannerContext extends DdlChange {
- public CreateTableScannerContext(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- context.execute(
- new CreateTableBuilder(getDialect(), "ce_scanner_context")
- .addPkColumn(newVarcharColumnDefBuilder().setColumnName("task_uuid").setLimit(UUID_SIZE).setIsNullable(false).setIgnoreOracleUnit(true).build())
- .addColumn(newBlobColumnDefBuilder().setColumnName("context_data").setIsNullable(false).build())
- .addColumn(newBigIntegerColumnDefBuilder().setColumnName("created_at").setIsNullable(false).build())
- .addColumn(newBigIntegerColumnDefBuilder().setColumnName("updated_at").setIsNullable(false).build())
- .build());
- }
-}
diff --git a/sonar-db/src/main/java/org/sonar/db/version/v61/DeleteProjectDashboards.java b/sonar-db/src/main/java/org/sonar/db/version/v61/DeleteProjectDashboards.java
deleted file mode 100644
index 3a8398ebf70..00000000000
--- a/sonar-db/src/main/java/org/sonar/db/version/v61/DeleteProjectDashboards.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2016 SonarSource SA
- * mailto:contact 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.db.version.v61;
-
-import java.sql.SQLException;
-import org.sonar.db.Database;
-import org.sonar.db.version.BaseDataChange;
-import org.sonar.db.version.MassUpdate;
-
-public class DeleteProjectDashboards extends BaseDataChange {
-
- public DeleteProjectDashboards(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- deleteWidgetProperties(context);
- deleteDashboardsAndWidgets(context);
- }
-
- private static void deleteWidgetProperties(Context context) throws SQLException {
- MassUpdate massUpdate = context.prepareMassUpdate();
- massUpdate.select("SELECT w.id " +
- "FROM widgets w " +
- " INNER JOIN dashboards d on w.dashboard_id=d.id " +
- "WHERE d.is_global=?")
- .setBoolean(1, false);
- massUpdate.update("DELETE from widget_properties WHERE widget_id=?");
- massUpdate.rowPluralName("delete widget properties of project dashboards");
- massUpdate.execute((row, update) -> {
- update.setLong(1, row.getLong(1));
- return true;
- });
- }
-
- private static void deleteDashboardsAndWidgets(Context context) throws SQLException {
- MassUpdate massUpdate = context.prepareMassUpdate();
- massUpdate.select("SELECT id FROM dashboards d WHERE d.is_global=?").setBoolean(1, false);
- massUpdate.update("DELETE from widgets WHERE dashboard_id=?");
- massUpdate.update("DELETE from active_dashboards WHERE dashboard_id=?");
- massUpdate.update("DELETE from dashboards WHERE id=?");
- massUpdate.rowPluralName("delete project dashboards");
- massUpdate.execute((row, update, updateIndex) -> {
- long dashboardId = row.getLong(1);
- switch (updateIndex) {
- case 0:
- case 1:
- case 2:
- update.setLong(1, dashboardId);
- return true;
- default:
- throw new IllegalArgumentException("Unsupported update index " + updateIndex);
- }
- });
- }
-}
diff --git a/sonar-db/src/main/java/org/sonar/db/version/v61/DeleteReportsFromCeQueue.java b/sonar-db/src/main/java/org/sonar/db/version/v61/DeleteReportsFromCeQueue.java
deleted file mode 100644
index 805e858aaf4..00000000000
--- a/sonar-db/src/main/java/org/sonar/db/version/v61/DeleteReportsFromCeQueue.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2016 SonarSource SA
- * mailto:contact 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.db.version.v61;
-
-import java.sql.SQLException;
-import org.sonar.db.Database;
-import org.sonar.db.ce.CeTaskTypes;
-import org.sonar.db.version.BaseDataChange;
-
-/**
- * SONAR-7903 - in version 6.1 analysis reports are not persisted on FS anymore
- * but in DB. For simplicity of migration report files are not copied to DB.
- * To avoid failures on missing reports, tasks are simply ignored and removed from
- * queue.
- */
-public class DeleteReportsFromCeQueue extends BaseDataChange {
-
- public DeleteReportsFromCeQueue(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- context
- .prepareUpsert("delete from ce_queue where task_type=?")
- .setString(1, CeTaskTypes.REPORT)
- .execute()
- .commit();
- }
-
-}
diff --git a/sonar-db/src/main/java/org/sonar/db/version/v61/DropIsGlobalFromDashboards.java b/sonar-db/src/main/java/org/sonar/db/version/v61/DropIsGlobalFromDashboards.java
deleted file mode 100644
index 2e378b98091..00000000000
--- a/sonar-db/src/main/java/org/sonar/db/version/v61/DropIsGlobalFromDashboards.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2016 SonarSource SA
- * mailto:contact 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.db.version.v61;
-
-import java.sql.SQLException;
-import org.sonar.db.Database;
-import org.sonar.db.version.DdlChange;
-import org.sonar.db.version.DropColumnsBuilder;
-
-public class DropIsGlobalFromDashboards extends DdlChange {
-
- private static final String TABLE_DASHBOARDS = "dashboards";
-
- public DropIsGlobalFromDashboards(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- context.execute(new DropColumnsBuilder(getDialect(), TABLE_DASHBOARDS, "is_global").build());
- }
-
-}
diff --git a/sonar-db/src/main/java/org/sonar/db/version/v61/DropTableActivities.java b/sonar-db/src/main/java/org/sonar/db/version/v61/DropTableActivities.java
deleted file mode 100644
index 8a009770694..00000000000
--- a/sonar-db/src/main/java/org/sonar/db/version/v61/DropTableActivities.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2016 SonarSource SA
- * mailto:contact 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.db.version.v61;
-
-import java.sql.SQLException;
-import org.sonar.db.Database;
-import org.sonar.db.version.DdlChange;
-import org.sonar.db.version.DropIndexBuilder;
-import org.sonar.db.version.DropTableBuilder;
-
-public class DropTableActivities extends DdlChange {
-
- private static final String TABLE_ACTIVITIES = "activities";
-
- public DropTableActivities(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- context.execute(new DropIndexBuilder(getDialect())
- .setTable(TABLE_ACTIVITIES)
- .setName("activities_log_key")
- .build());
-
- context.execute(new DropTableBuilder(getDialect(), TABLE_ACTIVITIES).build());
- }
-
-}
diff --git a/sonar-db/src/main/java/org/sonar/db/version/v61/DropTableProperties.java b/sonar-db/src/main/java/org/sonar/db/version/v61/DropTableProperties.java
deleted file mode 100644
index 32da55dab31..00000000000
--- a/sonar-db/src/main/java/org/sonar/db/version/v61/DropTableProperties.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2016 SonarSource SA
- * mailto:contact 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.db.version.v61;
-
-import java.sql.SQLException;
-import org.sonar.db.Database;
-import org.sonar.db.version.DdlChange;
-import org.sonar.db.version.DropIndexBuilder;
-import org.sonar.db.version.DropTableBuilder;
-
-public class DropTableProperties extends DdlChange {
-
- private static final String TABLE_PROPERTIES = "properties";
-
- public DropTableProperties(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- context.execute(new DropIndexBuilder(getDialect())
- .setTable(TABLE_PROPERTIES)
- .setName("properties_key")
- .build());
-
- context.execute(new DropTableBuilder(getDialect(), TABLE_PROPERTIES).build());
- }
-
-}
diff --git a/sonar-db/src/main/java/org/sonar/db/version/v61/PopulateTableProperties2.java b/sonar-db/src/main/java/org/sonar/db/version/v61/PopulateTableProperties2.java
deleted file mode 100644
index 58762c46dcf..00000000000
--- a/sonar-db/src/main/java/org/sonar/db/version/v61/PopulateTableProperties2.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2016 SonarSource SA
- * mailto:contact 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.db.version.v61;
-
-import java.sql.SQLException;
-import org.sonar.api.utils.System2;
-import org.sonar.db.Database;
-import org.sonar.db.version.BaseDataChange;
-import org.sonar.db.version.MassUpdate;
-import org.sonar.db.version.Select;
-import org.sonar.db.version.SqlStatement;
-
-public class PopulateTableProperties2 extends BaseDataChange {
- private final System2 system2;
-
- public PopulateTableProperties2(Database db, System2 system2) {
- super(db);
- this.system2 = system2;
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- MassUpdate massUpdate = context.prepareMassUpdate();
- massUpdate.select("SELECT" +
- " p.prop_key, p.resource_id, p.text_value, p.user_id" +
- " from properties p" +
- " left outer join properties2 p2" +
- " on p2.prop_key=p.prop_key" +
- " and (p2.resource_id=p.resource_id or (p2.resource_id is null and p.resource_id is null))" +
- " and (p2.user_id=p.user_id or (p2.user_id is null and p.user_id is null))" +
- " where" +
- " p2.id is null" +
- " order by p.id");
- massUpdate.update("insert into properties2" +
- " (prop_key, resource_id, user_id, is_empty, text_value, clob_value, created_at)" +
- " values " +
- " (?, ?, ?, ?, ?, ?, ?)");
- massUpdate.rowPluralName("copy data from table properties into table properties2");
- massUpdate.execute(this::handle);
- }
-
- private boolean handle(Select.Row row, SqlStatement update) throws SQLException {
- String key = row.getString(1);
- Integer resourceId = row.getNullableInt(2);
- String value = row.getNullableString(3);
- Integer userId = row.getNullableInt(4);
-
- update.setString(1, key);
- update.setInt(2, resourceId);
- update.setInt(3, userId);
- if (value == null || value.isEmpty()) {
- update.setBoolean(4, true);
- update.setString(5, null);
- update.setString(6, null);
- } else if (value.length() > 4000) {
- update.setBoolean(4, false);
- update.setString(5, null);
- update.setString(6, value);
- } else {
- update.setBoolean(4, false);
- update.setString(5, value);
- update.setString(6, null);
- }
- update.setLong(7, system2.now());
- return true;
- }
-}
diff --git a/sonar-db/src/main/java/org/sonar/db/version/v61/RemoveViewsDefinitionFromProperties.java b/sonar-db/src/main/java/org/sonar/db/version/v61/RemoveViewsDefinitionFromProperties.java
deleted file mode 100644
index 83efeb5aeac..00000000000
--- a/sonar-db/src/main/java/org/sonar/db/version/v61/RemoveViewsDefinitionFromProperties.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2016 SonarSource SA
- * mailto:contact 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.db.version.v61;
-
-import java.sql.SQLException;
-import javax.annotation.Nullable;
-import org.sonar.api.utils.System2;
-import org.sonar.db.Database;
-import org.sonar.db.version.BaseDataChange;
-import org.sonar.db.version.Upsert;
-
-public class RemoveViewsDefinitionFromProperties extends BaseDataChange {
-
- private static final String VIEWS_DEFINITION_PROPERTY_KEY = "views.def";
- private static final int VARCHAR_MAX_LENGTH = 4000;
-
- private final System2 system2;
-
- public RemoveViewsDefinitionFromProperties(Database db, System2 system2) {
- super(db);
- this.system2 = system2;
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- String property = context
- .prepareSelect("select text_value from properties where prop_key=?")
- .setString(1, VIEWS_DEFINITION_PROPERTY_KEY)
- .get(row -> row.getNullableString(1));
- Integer hasInternalProperty = context
- .prepareSelect("select 1 from internal_properties where kee=?")
- .setString(1, VIEWS_DEFINITION_PROPERTY_KEY)
- .get(row -> row.getNullableInt(1));
-
- if (hasInternalProperty == null) {
- addToInternalProperties(context, property);
- }
- deleteFromProperties(context);
- }
-
- private void addToInternalProperties(Context context, @Nullable String property) throws SQLException {
- if (property != null) {
- boolean mustBeStoredInClob = property.length() > VARCHAR_MAX_LENGTH;
- try (Upsert insert = context.prepareUpsert("insert into internal_properties" +
- " (kee, is_empty, " + (mustBeStoredInClob ? "clob_value" : "text_value") + ", created_at)" +
- " values" +
- " (?,?,?,?)")) {
- long now = system2.now();
- insert
- .setString(1, "views.def")
- .setBoolean(2, false)
- .setString(3, property)
- .setLong(4, now)
- .execute()
- .commit();
- }
- }
- }
-
- private static void deleteFromProperties(Context context) throws SQLException {
- try (Upsert delete = context.prepareUpsert("delete from properties where prop_key=?")) {
- delete
- .setString(1, VIEWS_DEFINITION_PROPERTY_KEY)
- .execute()
- .commit();
- }
- }
-
-}
diff --git a/sonar-db/src/main/java/org/sonar/db/version/v61/RenameTableProperties2ToProperties.java b/sonar-db/src/main/java/org/sonar/db/version/v61/RenameTableProperties2ToProperties.java
deleted file mode 100644
index d6e79143e29..00000000000
--- a/sonar-db/src/main/java/org/sonar/db/version/v61/RenameTableProperties2ToProperties.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2016 SonarSource SA
- * mailto:contact 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.db.version.v61;
-
-import java.sql.SQLException;
-import org.sonar.db.Database;
-import org.sonar.db.version.CreateIndexBuilder;
-import org.sonar.db.version.DdlChange;
-import org.sonar.db.version.DropIndexBuilder;
-import org.sonar.db.version.RenameTableBuilder;
-
-import static org.sonar.db.version.VarcharColumnDef.newVarcharColumnDefBuilder;
-
-public class RenameTableProperties2ToProperties extends DdlChange {
-
- public RenameTableProperties2ToProperties(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- context.execute(new DropIndexBuilder(getDialect())
- .setTable("properties2")
- .setName("properties2_key")
- .build());
-
- context.execute(new RenameTableBuilder(getDialect())
- .setName("properties2")
- .setNewName("properties")
- .build());
-
- context.execute(new CreateIndexBuilder(getDialect())
- .setTable("properties")
- .setName("properties_key")
- .addColumn(newVarcharColumnDefBuilder().setColumnName("prop_key").setLimit(512).setIsNullable(false).setIgnoreOracleUnit(true).build())
- .build());
- }
-
-}
diff --git a/sonar-db/src/main/java/org/sonar/db/version/v61/ShrinkModuleUuidPathOfProjects.java b/sonar-db/src/main/java/org/sonar/db/version/v61/ShrinkModuleUuidPathOfProjects.java
deleted file mode 100644
index aac5ef86a70..00000000000
--- a/sonar-db/src/main/java/org/sonar/db/version/v61/ShrinkModuleUuidPathOfProjects.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2016 SonarSource SA
- * mailto:contact 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.db.version.v61;
-
-import java.sql.SQLException;
-import org.sonar.db.Database;
-import org.sonar.db.version.AlterColumnsBuilder;
-import org.sonar.db.version.DdlChange;
-
-import static org.sonar.db.version.VarcharColumnDef.newVarcharColumnDefBuilder;
-
-public class ShrinkModuleUuidPathOfProjects extends DdlChange {
-
- private static final String TABLE_PROJECTS = "projects";
-
- public ShrinkModuleUuidPathOfProjects(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- context.execute(new AlterColumnsBuilder(getDatabase().getDialect(), TABLE_PROJECTS)
- .updateColumn(newVarcharColumnDefBuilder().setColumnName("module_uuid_path").setLimit(1500).setIsNullable(true).setIgnoreOracleUnit(true).build())
- .build());
- }
-
-}
diff --git a/sonar-db/src/main/java/org/sonar/db/version/v61/package-info.java b/sonar-db/src/main/java/org/sonar/db/version/v61/package-info.java
deleted file mode 100644
index bcfd847df32..00000000000
--- a/sonar-db/src/main/java/org/sonar/db/version/v61/package-info.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2016 SonarSource SA
- * mailto:contact 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.db.version.v61;
-
-import javax.annotation.ParametersAreNonnullByDefault;
diff --git a/sonar-db/src/test/java/org/sonar/db/version/MigrationStepModuleTest.java b/sonar-db/src/test/java/org/sonar/db/version/MigrationStepModuleTest.java
index 36c2faf4ff6..68b3e0c0eda 100644
--- a/sonar-db/src/test/java/org/sonar/db/version/MigrationStepModuleTest.java
+++ b/sonar-db/src/test/java/org/sonar/db/version/MigrationStepModuleTest.java
@@ -29,6 +29,6 @@ public class MigrationStepModuleTest {
public void verify_count_of_added_MigrationStep_types() {
ComponentContainer container = new ComponentContainer();
new MigrationStepModule().configure(container);
- assertThat(container.size()).isEqualTo(99);
+ assertThat(container.size()).isEqualTo(81);
}
}
diff --git a/sonar-db/src/test/java/org/sonar/db/version/v61/AddErrorColumnsToCeActivityTest.java b/sonar-db/src/test/java/org/sonar/db/version/v61/AddErrorColumnsToCeActivityTest.java
deleted file mode 100644
index 31085a73359..00000000000
--- a/sonar-db/src/test/java/org/sonar/db/version/v61/AddErrorColumnsToCeActivityTest.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2016 SonarSource SA
- * mailto:contact 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.db.version.v61;
-
-import java.sql.SQLException;
-import java.sql.Types;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-import org.sonar.api.utils.System2;
-import org.sonar.db.DbTester;
-
-import static java.lang.String.valueOf;
-
-public class AddErrorColumnsToCeActivityTest {
-
- private static final String TABLE = "CE_ACTIVITY";
-
- @Rule
- public DbTester db = DbTester.createForSchema(System2.INSTANCE, AddErrorColumnsToCeActivityTest.class, "old_ce_activity.sql");
- @Rule
- public ExpectedException expectedException = ExpectedException.none();
-
- private AddErrorColumnsToCeActivity underTest = new AddErrorColumnsToCeActivity(db.database());
-
- @Test
- public void migration_adds_column_to_empty_table() throws SQLException {
- underTest.execute();
-
- verifyAddedColumns();
- }
-
- @Test
- public void migration_adds_columns_to_populated_table() throws SQLException {
- for (int i = 0; i < 9; i++) {
- db.executeInsert(
- TABLE,
- "uuid", valueOf(i),
- "task_type", "PROJECT",
- "component_uuid", valueOf(i + 20),
- "analysis_uuid", valueOf(i + 30),
- "status", "ok",
- "is_last", "true",
- "is_last_key", "aa",
- "submitted_at", valueOf(84654),
- "created_at", valueOf(9512),
- "updated_at", valueOf(45120));
- }
- db.commit();
-
- 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(TABLE, "error_message", Types.VARCHAR, 1000, true);
- db.assertColumnDefinition(TABLE, "error_stacktrace", Types.CLOB, null, true);
- }
-
-}
diff --git a/sonar-db/src/test/java/org/sonar/db/version/v61/CopyActivitiesToQprofileChangesTest.java b/sonar-db/src/test/java/org/sonar/db/version/v61/CopyActivitiesToQprofileChangesTest.java
deleted file mode 100644
index 022de4b64af..00000000000
--- a/sonar-db/src/test/java/org/sonar/db/version/v61/CopyActivitiesToQprofileChangesTest.java
+++ /dev/null
@@ -1,133 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2016 SonarSource SA
- * mailto:contact 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.db.version.v61;
-
-import java.sql.SQLException;
-import java.util.Date;
-import java.util.Map;
-import javax.annotation.Nullable;
-import org.junit.Rule;
-import org.junit.Test;
-import org.sonar.api.utils.System2;
-import org.sonar.db.DbTester;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-
-public class CopyActivitiesToQprofileChangesTest {
-
- private static final long A_DATE = 1_500_000_000_000L;
- private static final String TABLE_ACTIVITIES = "activities";
- private static final String TABLE_QPROFILE_CHANGES = "qprofile_changes";
-
- @Rule
- public DbTester db = DbTester.createForSchema(System2.INSTANCE, CopyActivitiesToQprofileChangesTest.class, "schema.sql");
-
- private CopyActivitiesToQprofileChanges underTest = new CopyActivitiesToQprofileChanges(db.database());
-
- @Test
- public void migration_has_no_effect_on_empty_table() throws SQLException {
- underTest.execute();
-
- assertThat(db.countRowsOfTable(TABLE_QPROFILE_CHANGES)).isEqualTo(0);
- }
-
- @Test
- public void copy_qprofile_changes() throws SQLException {
- String key = "U1";
- String profileKey = "P1";
- String login = "marcel";
- String type = "ACTIVATED";
- String data = "D1";
- insertActivity(key, profileKey, login, "QPROFILE", type, data, A_DATE);
-
- underTest.execute();
-
- assertThat(db.countRowsOfTable(TABLE_QPROFILE_CHANGES)).isEqualTo(1);
- Map<String, Object> change = selectChangeByKey(key);
- assertThat(change.get("qprofileKey")).isEqualTo(profileKey);
- assertThat(change.get("createdAt")).isEqualTo(A_DATE);
- assertThat(change.get("login")).isEqualTo(login);
- assertThat(change.get("changeType")).isEqualTo(type);
- assertThat(change.get("changeData")).isEqualTo(data);
- }
-
- /**
- * Do not copy twice the same row
- */
- @Test
- public void copy_is_reentrant() throws SQLException {
- insertActivity("U1", "P1", "marcel", "QPROFILE", "ACTIVATED", "D1", A_DATE);
-
- // first run
- underTest.execute();
- assertThat(db.countRowsOfTable(TABLE_QPROFILE_CHANGES)).isEqualTo(1);
-
- // second run
- underTest.execute();
- assertThat(db.countRowsOfTable(TABLE_QPROFILE_CHANGES)).isEqualTo(1);
- }
-
- @Test
- public void copy_nullable_fields() throws SQLException {
- String key = "U1";
- String type = "ACTIVATED";
- // no login nor data
- insertActivity(key, "P1", null, "QPROFILE", type, null, A_DATE);
-
- underTest.execute();
-
- Map<String, Object> change = selectChangeByKey(key);
- assertThat(change.get("qprofileKey")).isEqualTo("P1");
- assertThat(change.get("createdAt")).isEqualTo(A_DATE);
- assertThat(change.get("changeType")).isEqualTo(type);
- assertThat(change.get("login")).isNull();
- assertThat(change.get("data")).isNull();
- }
-
- @Test
- public void ignore_activities_that_do_not_relate_to_qprofiles() throws SQLException {
- insertActivity("U1", "P1", "marcel", "OTHER_ACTIVITY_TYPE", "T1", "D1", A_DATE);
-
- underTest.execute();
-
- assertThat(db.countRowsOfTable(TABLE_QPROFILE_CHANGES)).isEqualTo(0);
- }
-
- @Test
- public void ignore_invalid_activities() throws SQLException {
- // no change type
- insertActivity("U1", "P1", "marcel", "QPROFILE", null, "D1", A_DATE);
- // no date
- insertActivity("U2", "P1", "marcel", "QPROFILE", "ACTIVATED", "D1", null);
-
- underTest.execute();
-
- assertThat(db.countRowsOfTable(TABLE_QPROFILE_CHANGES)).isEqualTo(0);
- }
-
- private void insertActivity(String key, @Nullable String profileKey, @Nullable String login, @Nullable String activityType, @Nullable String type, @Nullable String data, @Nullable Long createdAt) {
- db.executeInsert(TABLE_ACTIVITIES, "log_key", key, "profile_key", profileKey, "user_login", login, "log_type", activityType, "log_action", type, "data_field", data, "created_at", createdAt != null ? new Date(createdAt) : null);
- }
-
- private Map<String, Object> selectChangeByKey(String key) {
- return db.selectFirst("select qprofile_key as \"qprofileKey\", created_at as \"createdAt\", user_login as \"login\", change_type as \"changeType\", change_data as \"changeData\" from qprofile_changes where kee='" + key + "'");
- }
-}
diff --git a/sonar-db/src/test/java/org/sonar/db/version/v61/CreateTableCeTaskInputTest.java b/sonar-db/src/test/java/org/sonar/db/version/v61/CreateTableCeTaskInputTest.java
deleted file mode 100644
index eb6d1dfd1a5..00000000000
--- a/sonar-db/src/test/java/org/sonar/db/version/v61/CreateTableCeTaskInputTest.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2016 SonarSource SA
- * mailto:contact 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.db.version.v61;
-
-import java.sql.SQLException;
-import java.sql.Types;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-import org.sonar.api.utils.System2;
-import org.sonar.db.DbTester;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-public class CreateTableCeTaskInputTest {
- private static final String TABLE_CE_TASK_INPUT = "ce_task_input";
-
- @Rule
- public final DbTester dbTester = DbTester.createForSchema(System2.INSTANCE, CreateTableCeTaskInputTest.class, "empty.sql");
- @Rule
- public ExpectedException expectedException = ExpectedException.none();
-
- private CreateTableCeTaskInput underTest = new CreateTableCeTaskInput(dbTester.database());
-
- @Test
- public void creates_table_on_empty_db() throws SQLException {
- underTest.execute();
-
- assertThat(dbTester.countRowsOfTable(TABLE_CE_TASK_INPUT)).isEqualTo(0);
-
- dbTester.assertColumnDefinition(TABLE_CE_TASK_INPUT, "task_uuid", Types.VARCHAR, 40, false);
- dbTester.assertColumnDefinition(TABLE_CE_TASK_INPUT, "input_data", Types.BLOB, null, true);
- dbTester.assertColumnDefinition(TABLE_CE_TASK_INPUT, "created_at", Types.BIGINT, null, false);
- dbTester.assertColumnDefinition(TABLE_CE_TASK_INPUT, "updated_at", Types.BIGINT, null, false);
- dbTester.assertPrimaryKey(TABLE_CE_TASK_INPUT, "pk_" + TABLE_CE_TASK_INPUT, "task_uuid");
- }
-
- @Test
- public void migration_is_not_reentrant() throws SQLException {
- underTest.execute();
-
- expectedException.expect(IllegalStateException.class);
-
- underTest.execute();
- }
-}
diff --git a/sonar-db/src/test/java/org/sonar/db/version/v61/CreateTableInternalPropertiesTest.java b/sonar-db/src/test/java/org/sonar/db/version/v61/CreateTableInternalPropertiesTest.java
deleted file mode 100644
index 768144a2d70..00000000000
--- a/sonar-db/src/test/java/org/sonar/db/version/v61/CreateTableInternalPropertiesTest.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2016 SonarSource SA
- * mailto:contact 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.db.version.v61;
-
-import java.sql.SQLException;
-import java.sql.Types;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-import org.sonar.api.utils.System2;
-import org.sonar.db.DbTester;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-public class CreateTableInternalPropertiesTest {
- private static final String TABLE_INTERNAL_PROPERTIES = "internal_properties";
-
- @Rule
- public final DbTester dbTester = DbTester.createForSchema(System2.INSTANCE, CreateTableInternalPropertiesTest.class, "empty.sql");
- @Rule
- public ExpectedException expectedException = ExpectedException.none();
-
- private CreateTableInternalProperties underTest = new CreateTableInternalProperties(dbTester.database());
-
- @Test
- public void creates_table_on_empty_db() throws SQLException {
- underTest.execute();
-
- assertThat(dbTester.countRowsOfTable(TABLE_INTERNAL_PROPERTIES)).isEqualTo(0);
-
- dbTester.assertColumnDefinition(TABLE_INTERNAL_PROPERTIES, "kee", Types.VARCHAR, 20, false);
- dbTester.assertColumnDefinition(TABLE_INTERNAL_PROPERTIES, "is_empty", Types.BOOLEAN, null, false);
- dbTester.assertColumnDefinition(TABLE_INTERNAL_PROPERTIES, "text_value", Types.VARCHAR, 4000, true);
- dbTester.assertColumnDefinition(TABLE_INTERNAL_PROPERTIES, "clob_value", Types.CLOB, null, true);
- dbTester.assertColumnDefinition(TABLE_INTERNAL_PROPERTIES, "created_at", Types.BIGINT, null, false);
- dbTester.assertPrimaryKey(TABLE_INTERNAL_PROPERTIES, "pk_" + TABLE_INTERNAL_PROPERTIES, "kee");
- }
-
- @Test
- public void migration_is_not_reentrant() throws SQLException {
- underTest.execute();
-
- expectedException.expect(IllegalStateException.class);
-
- underTest.execute();
- }
-
-}
diff --git a/sonar-db/src/test/java/org/sonar/db/version/v61/CreateTableProperties2Test.java b/sonar-db/src/test/java/org/sonar/db/version/v61/CreateTableProperties2Test.java
deleted file mode 100644
index 223b84ff0e5..00000000000
--- a/sonar-db/src/test/java/org/sonar/db/version/v61/CreateTableProperties2Test.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2016 SonarSource SA
- * mailto:contact 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.db.version.v61;
-
-import java.sql.SQLException;
-import java.sql.Types;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-import org.sonar.api.utils.System2;
-import org.sonar.db.DbTester;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-public class CreateTableProperties2Test {
- private static final String TABLE_PROPERTIES_2 = "properties2";
-
- @Rule
- public final DbTester dbTester = DbTester.createForSchema(System2.INSTANCE, CreateTableProperties2Test.class, "empty.sql");
- @Rule
- public ExpectedException expectedException = ExpectedException.none();
-
- private CreateTableProperties2 underTest = new CreateTableProperties2(dbTester.database());
-
- @Test
- public void creates_table_on_empty_db() throws SQLException {
- underTest.execute();
-
- assertThat(dbTester.countRowsOfTable(TABLE_PROPERTIES_2)).isEqualTo(0);
-
- dbTester.assertColumnDefinition(TABLE_PROPERTIES_2, "id", Types.INTEGER, null, false);
- dbTester.assertColumnDefinition(TABLE_PROPERTIES_2, "prop_key", Types.VARCHAR, 512, false);
- dbTester.assertColumnDefinition(TABLE_PROPERTIES_2, "resource_id", Types.BIGINT, null, true);
- dbTester.assertColumnDefinition(TABLE_PROPERTIES_2, "user_id", Types.BIGINT, null, true);
- dbTester.assertColumnDefinition(TABLE_PROPERTIES_2, "is_empty", Types.BOOLEAN, null, false);
- dbTester.assertColumnDefinition(TABLE_PROPERTIES_2, "text_value", Types.VARCHAR, 4000, true);
- dbTester.assertColumnDefinition(TABLE_PROPERTIES_2, "clob_value", Types.CLOB, null, true);
- dbTester.assertColumnDefinition(TABLE_PROPERTIES_2, "created_at", Types.BIGINT, null, false);
- dbTester.assertPrimaryKey(TABLE_PROPERTIES_2, "pk_properties", "id");
- }
-
- @Test
- public void migration_is_not_reentrant() throws SQLException {
- underTest.execute();
-
- expectedException.expect(IllegalStateException.class);
-
- underTest.execute();
- }
-
-}
diff --git a/sonar-db/src/test/java/org/sonar/db/version/v61/CreateTableQprofileChangesTest.java b/sonar-db/src/test/java/org/sonar/db/version/v61/CreateTableQprofileChangesTest.java
deleted file mode 100644
index 362e9cd96e4..00000000000
--- a/sonar-db/src/test/java/org/sonar/db/version/v61/CreateTableQprofileChangesTest.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2016 SonarSource SA
- * mailto:contact 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.db.version.v61;
-
-import java.sql.SQLException;
-import java.sql.Types;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-import org.sonar.api.utils.System2;
-import org.sonar.db.DbTester;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-public class CreateTableQprofileChangesTest {
- private static final String TABLE_QPROFILE_CHANGES = "qprofile_changes";
-
- @Rule
- public final DbTester dbTester = DbTester.createForSchema(System2.INSTANCE, CreateTableQprofileChangesTest.class, "empty.sql");
- @Rule
- public ExpectedException expectedException = ExpectedException.none();
-
- private CreateTableQprofileChanges underTest = new CreateTableQprofileChanges(dbTester.database());
-
- @Test
- public void creates_table_on_empty_db() throws SQLException {
- underTest.execute();
-
- assertThat(dbTester.countRowsOfTable(TABLE_QPROFILE_CHANGES)).isEqualTo(0);
-
- dbTester.assertColumnDefinition(TABLE_QPROFILE_CHANGES, "kee", Types.VARCHAR, 40, false);
- dbTester.assertColumnDefinition(TABLE_QPROFILE_CHANGES, "qprofile_key", Types.VARCHAR, 255, false);
- dbTester.assertColumnDefinition(TABLE_QPROFILE_CHANGES, "change_type", Types.VARCHAR, 20, false);
- dbTester.assertColumnDefinition(TABLE_QPROFILE_CHANGES, "user_login", Types.VARCHAR, 255, true);
- dbTester.assertColumnDefinition(TABLE_QPROFILE_CHANGES, "change_data", Types.CLOB, null, true);
- dbTester.assertColumnDefinition(TABLE_QPROFILE_CHANGES, "created_at", Types.BIGINT, null, false);
- dbTester.assertPrimaryKey(TABLE_QPROFILE_CHANGES, "pk_" + TABLE_QPROFILE_CHANGES, "kee");
- }
-
- @Test
- public void migration_is_not_reentrant() throws SQLException {
- underTest.execute();
-
- expectedException.expect(IllegalStateException.class);
-
- underTest.execute();
- }
-}
diff --git a/sonar-db/src/test/java/org/sonar/db/version/v61/CreateTableRuleRepositoriesTest.java b/sonar-db/src/test/java/org/sonar/db/version/v61/CreateTableRuleRepositoriesTest.java
deleted file mode 100644
index f3cb6303bd1..00000000000
--- a/sonar-db/src/test/java/org/sonar/db/version/v61/CreateTableRuleRepositoriesTest.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2016 SonarSource SA
- * mailto:contact 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.db.version.v61;
-
-import java.sql.SQLException;
-import java.sql.Types;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-import org.sonar.api.utils.System2;
-import org.sonar.db.DbTester;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-public class CreateTableRuleRepositoriesTest {
- private static final String TABLE_RULE_REPOSITORIES = "rule_repositories";
-
- @Rule
- public final DbTester dbTester = DbTester.createForSchema(System2.INSTANCE, CreateTableRuleRepositoriesTest.class, "empty.sql");
- @Rule
- public ExpectedException expectedException = ExpectedException.none();
-
- private CreateTableRuleRepositories underTest = new CreateTableRuleRepositories(dbTester.database());
-
- @Test
- public void creates_table_on_empty_db() throws SQLException {
- underTest.execute();
-
- assertThat(dbTester.countRowsOfTable(TABLE_RULE_REPOSITORIES)).isEqualTo(0);
-
- dbTester.assertColumnDefinition(TABLE_RULE_REPOSITORIES, "kee", Types.VARCHAR, 200, false);
- dbTester.assertColumnDefinition(TABLE_RULE_REPOSITORIES, "language", Types.VARCHAR, 20, false);
- dbTester.assertColumnDefinition(TABLE_RULE_REPOSITORIES, "name", Types.VARCHAR, 4000, false);
- dbTester.assertColumnDefinition(TABLE_RULE_REPOSITORIES, "created_at", Types.BIGINT, null, false);
- dbTester.assertPrimaryKey(TABLE_RULE_REPOSITORIES, "pk_" + TABLE_RULE_REPOSITORIES, "kee");
- }
-
- @Test
- public void migration_is_not_reentrant() throws SQLException {
- underTest.execute();
-
- expectedException.expect(IllegalStateException.class);
-
- underTest.execute();
- }
-}
diff --git a/sonar-db/src/test/java/org/sonar/db/version/v61/CreateTableScannerContextTest.java b/sonar-db/src/test/java/org/sonar/db/version/v61/CreateTableScannerContextTest.java
deleted file mode 100644
index 0847efdae5d..00000000000
--- a/sonar-db/src/test/java/org/sonar/db/version/v61/CreateTableScannerContextTest.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2016 SonarSource SA
- * mailto:contact 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.db.version.v61;
-
-import java.sql.SQLException;
-import java.sql.Types;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-import org.sonar.api.utils.System2;
-import org.sonar.db.DbTester;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-public class CreateTableScannerContextTest {
- private static final String TABLE_CE_SCANNER_CONTEXT = "ce_scanner_context";
-
- @Rule
- public final DbTester dbTester = DbTester.createForSchema(System2.INSTANCE, CreateTableCeTaskInputTest.class, "empty.sql");
- @Rule
- public ExpectedException expectedException = ExpectedException.none();
-
- private CreateTableScannerContext underTest = new CreateTableScannerContext(dbTester.database());
-
- @Test
- public void creates_table_on_empty_db() throws SQLException {
- underTest.execute();
-
- assertThat(dbTester.countRowsOfTable(TABLE_CE_SCANNER_CONTEXT)).isEqualTo(0);
-
- dbTester.assertColumnDefinition(TABLE_CE_SCANNER_CONTEXT, "task_uuid", Types.VARCHAR, 40, false);
- dbTester.assertColumnDefinition(TABLE_CE_SCANNER_CONTEXT, "context_data", Types.BLOB, null, false);
- dbTester.assertColumnDefinition(TABLE_CE_SCANNER_CONTEXT, "created_at", Types.BIGINT, null, false);
- dbTester.assertColumnDefinition(TABLE_CE_SCANNER_CONTEXT, "updated_at", Types.BIGINT, null, false);
- dbTester.assertPrimaryKey(TABLE_CE_SCANNER_CONTEXT, "pk_" + TABLE_CE_SCANNER_CONTEXT, "task_uuid");
- }
-
- @Test
- public void migration_is_not_reentrant() throws SQLException {
- underTest.execute();
-
- expectedException.expect(IllegalStateException.class);
-
- underTest.execute();
- }
-}
diff --git a/sonar-db/src/test/java/org/sonar/db/version/v61/DeleteProjectDashboardsTest.java b/sonar-db/src/test/java/org/sonar/db/version/v61/DeleteProjectDashboardsTest.java
deleted file mode 100644
index 705fd7f2774..00000000000
--- a/sonar-db/src/test/java/org/sonar/db/version/v61/DeleteProjectDashboardsTest.java
+++ /dev/null
@@ -1,141 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2016 SonarSource SA
- * mailto:contact 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.db.version.v61;
-
-import java.sql.SQLException;
-import java.util.Arrays;
-import java.util.List;
-import java.util.stream.Collectors;
-import org.junit.Rule;
-import org.junit.Test;
-import org.sonar.api.utils.System2;
-import org.sonar.db.DbTester;
-
-import static java.lang.String.valueOf;
-import static org.assertj.core.api.Assertions.assertThat;
-
-public class DeleteProjectDashboardsTest {
- @Rule
- public DbTester db = DbTester.createForSchema(System2.INSTANCE, DeleteProjectDashboardsTest.class, "schema.sql");
-
- private DeleteProjectDashboards underTest = new DeleteProjectDashboards(db.database());
-
- @Test
- public void no_effect_on_empty_tables() throws SQLException {
- underTest.execute();
-
- assertThat(db.countRowsOfTable("dashboards")).isEqualTo(0);
- }
-
- @Test
- public void delete_project_dashboard_data() throws SQLException {
- insertGlobalDashboards(1L, 10L, 11L);
- insertProjectDashboards(2L, 20L, 21L);
- insertActiveDashboards(1L, 10L, 11L, 12L);
- insertActiveDashboards(2L, 20L, 21L, 22L);
- insertWidgets(1L, 100L, 101L, 102L);
- insertWidgets(2L, 200L, 201L, 202L);
- insertWidgetProperties(100L, 1001L, 1002L, 1003L);
- insertWidgetProperties(202L, 2021L, 2022L, 2023L);
-
- underTest.execute();
-
- assertIdsOfDashboardsAre(1L, 10L, 11L);
- assertIdsOfActiveDashboardsAre(10L, 11L, 12L);
- assertIdsOfWidgetsAre(100L, 101L, 102L);
- assertIdsOfWidgetPropertiesAre(1001L, 1002L, 1003L);
- }
-
- @Test
- public void is_reentrant() throws SQLException {
- insertGlobalDashboards(10L, 11L, 12L);
- insertProjectDashboards(20L, 21L, 22L);
- underTest.execute();
- assertIdsOfDashboardsAre(10L, 11L, 12L);
-
- underTest.execute();
- assertIdsOfDashboardsAre(10L, 11L, 12L);
- }
-
- private void insertProjectDashboards(long... ids) {
- Arrays.stream(ids).forEach(id -> insertDashboard(id, false));
- }
-
- private void insertGlobalDashboards(long... ids) {
- Arrays.stream(ids).forEach(id -> insertDashboard(id, true));
- }
-
- private void insertDashboard(long id, boolean isGlobal) {
- db.executeInsert(
- "dashboards",
- "ID", valueOf(id),
- "IS_GLOBAL", valueOf(isGlobal));
- }
-
- private void insertActiveDashboards(long dashboardId, long... ids) {
- Arrays.stream(ids).forEach(
- id -> db.executeInsert(
- "active_dashboards",
- "ID", valueOf(id),
- "DASHBOARD_ID", valueOf(dashboardId)));
- }
-
- private void insertWidgets(long dashboardId, long... ids) {
- Arrays.stream(ids).forEach(
- id -> db.executeInsert(
- "widgets",
- "ID", valueOf(id),
- "WIDGET_KEY", valueOf(id),
- "DASHBOARD_ID", valueOf(dashboardId)));
- }
-
- private void insertWidgetProperties(long widgetId, long... ids) {
- Arrays.stream(ids).forEach(
- id -> db.executeInsert(
- "widget_properties",
- "ID", valueOf(id),
- "WIDGET_ID", valueOf(widgetId)));
- }
-
- private void assertIdsOfDashboardsAre(Long... ids) {
- List<Long> idsInDb = db.select("select ID from dashboards").stream().map(map -> (Long) map.get("ID")).collect(Collectors.toList());
-
- assertThat(idsInDb).containsOnly(ids);
- }
-
- private void assertIdsOfActiveDashboardsAre(Long... ids) {
- List<Long> idsInDb = db.select("select ID from active_dashboards").stream().map(map -> (Long) map.get("ID")).collect(Collectors.toList());
-
- assertThat(idsInDb).containsOnly(ids);
- }
-
- private void assertIdsOfWidgetsAre(Long... ids) {
- List<Long> idsInDb = db.select("select ID from widgets").stream().map(map -> (Long) map.get("ID")).collect(Collectors.toList());
-
- assertThat(idsInDb).containsOnly(ids);
- }
-
- private void assertIdsOfWidgetPropertiesAre(Long... ids) {
- List<Long> idsInDb = db.select("select ID from widget_properties").stream().map(map -> (Long) map.get("ID")).collect(Collectors.toList());
-
- assertThat(idsInDb).containsOnly(ids);
- }
-}
diff --git a/sonar-db/src/test/java/org/sonar/db/version/v61/DeleteReportsFromCeQueueTest.java b/sonar-db/src/test/java/org/sonar/db/version/v61/DeleteReportsFromCeQueueTest.java
deleted file mode 100644
index a357db11dd6..00000000000
--- a/sonar-db/src/test/java/org/sonar/db/version/v61/DeleteReportsFromCeQueueTest.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2016 SonarSource SA
- * mailto:contact 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.db.version.v61;
-
-import java.sql.SQLException;
-import java.util.List;
-import java.util.Map;
-import org.junit.Rule;
-import org.junit.Test;
-import org.sonar.api.utils.System2;
-import org.sonar.db.DbTester;
-import org.sonar.db.ce.CeTaskTypes;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-public class DeleteReportsFromCeQueueTest {
-
- private static final long NOW = 1_500_000_000_000L;
- private static final String TABLE_NAME = "ce_queue";
-
- @Rule
- public DbTester db = DbTester.createForSchema(System2.INSTANCE, DeleteReportsFromCeQueueTest.class, "schema.sql");
-
- private DeleteReportsFromCeQueue underTest = new DeleteReportsFromCeQueue(db.database());
-
- @Test
- public void no_effect_on_empty_tables() throws SQLException {
- underTest.execute();
-
- assertThat(db.countRowsOfTable(TABLE_NAME)).isEqualTo(0);
- }
-
- @Test
- public void delete_tasks_with_type_REPORT_only() throws SQLException {
- db.executeInsert("ce_queue", "uuid", "U1", "task_type", CeTaskTypes.REPORT, "status", "PENDING", "created_at", NOW, "updated_at", NOW);
- db.executeInsert("ce_queue", "uuid", "U2", "task_type", "REFRESH_VIEWS", "status", "PENDING", "created_at", NOW, "updated_at", NOW);
-
- underTest.execute();
-
- List<Map<String, Object>> uuids = db.select("select uuid as \"uuid\" from ce_queue");
- assertThat(uuids).hasSize(1);
- assertThat(uuids.get(0).get("uuid")).isEqualTo("U2");
- }
-}
diff --git a/sonar-db/src/test/java/org/sonar/db/version/v61/DropIsGlobalFromDashboardsTest.java b/sonar-db/src/test/java/org/sonar/db/version/v61/DropIsGlobalFromDashboardsTest.java
deleted file mode 100644
index 346d4c54355..00000000000
--- a/sonar-db/src/test/java/org/sonar/db/version/v61/DropIsGlobalFromDashboardsTest.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2016 SonarSource SA
- * mailto:contact 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.db.version.v61;
-
-import java.sql.SQLException;
-import org.junit.Test;
-import org.sonar.db.Database;
-import org.sonar.db.dialect.PostgreSql;
-import org.sonar.db.version.DdlChange;
-
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
-public class DropIsGlobalFromDashboardsTest {
-
- Database database = mock(Database.class);
-
- DropIsGlobalFromDashboards underTest = new DropIsGlobalFromDashboards(database);
-
- @Test
- public void verify_generated_sql_on_postgresql() throws SQLException {
- when(database.getDialect()).thenReturn(new PostgreSql());
-
- DdlChange.Context context = mock(DdlChange.Context.class);
- underTest.execute(context);
-
- verify(context).execute("ALTER TABLE dashboards DROP COLUMN is_global");
- }
-}
diff --git a/sonar-db/src/test/java/org/sonar/db/version/v61/PopulateTableProperties2Test.java b/sonar-db/src/test/java/org/sonar/db/version/v61/PopulateTableProperties2Test.java
deleted file mode 100644
index 7bc68019971..00000000000
--- a/sonar-db/src/test/java/org/sonar/db/version/v61/PopulateTableProperties2Test.java
+++ /dev/null
@@ -1,406 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2016 SonarSource SA
- * mailto:contact 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.db.version.v61;
-
-import java.sql.SQLException;
-import java.util.Map;
-import java.util.Objects;
-import javax.annotation.CheckForNull;
-import javax.annotation.Nullable;
-import org.assertj.core.api.AbstractAssert;
-import org.junit.Rule;
-import org.junit.Test;
-import org.sonar.api.utils.System2;
-import org.sonar.db.DbSession;
-import org.sonar.db.DbTester;
-
-import static java.lang.Boolean.FALSE;
-import static java.lang.Boolean.TRUE;
-import static java.lang.String.valueOf;
-import static java.util.Objects.requireNonNull;
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
-public class PopulateTableProperties2Test {
- private static final String EMPTY_PROPERTY = "";
- private static final String VALUE_SMALL = "some small value";
- private static final String VALUE_SIZE_4000 = String.format("%1$4000.4000s", "*");
- private static final String VALUE_SIZE_4001 = VALUE_SIZE_4000 + "P";
- private static final long DATE_1 = 1_555_000L;
- private static final long DATE_2 = 2_666_000L;
- private static final long DATE_3 = 3_777_000L;
- private static final long DATE_4 = 4_888_000L;
-
- private System2 system2 = mock(System2.class);
-
- @Rule
- public DbTester dbTester = DbTester.createForSchema(system2, PopulateTableProperties2Test.class,
- "properties_and_properties_2_tables.sql");
-
- private PopulateTableProperties2 underTest = new PopulateTableProperties2(dbTester.database(), system2);
-
- @Test
- public void migration_has_no_effect_on_empty_tables() throws SQLException {
- underTest.execute();
-
- assertThat(dbTester.countRowsOfTable("properties")).isEqualTo(0);
- assertThat(dbTester.countRowsOfTable("properties2")).isEqualTo(0);
- }
-
- @Test
- public void migration_does_copy_again_properties_which_are_already_copied() throws SQLException {
- insertProperty(1, VALUE_SMALL, null, null);
- insertProperty(10, VALUE_SMALL, null, null);
- insertProperty(2, VALUE_SMALL, null, 21);
- insertProperty(20, VALUE_SMALL, null, 21);
- insertProperty(3, VALUE_SMALL, 31, null);
- insertProperty(30, VALUE_SMALL, 31, null);
-
- insertProperty2(1, VALUE_SMALL, null, null);
- insertProperty2(2, VALUE_SMALL, null, 21);
- insertProperty2(3, VALUE_SMALL, 31, null);
-
- assertThat(dbTester.countRowsOfTable("properties")).isEqualTo(6);
- assertThat(dbTester.countRowsOfTable("properties2")).isEqualTo(3);
-
- underTest.execute();
-
- assertThat(dbTester.countRowsOfTable("properties")).isEqualTo(6);
- assertThat(dbTester.countRowsOfTable("properties2")).isEqualTo(6);
- }
-
- @Test
- public void migration_moves_global_properties() throws SQLException {
- when(system2.now()).thenReturn(DATE_1, DATE_2, DATE_3, DATE_4);
-
- insertProperty(1, VALUE_SMALL, null, null);
- insertProperty(2, EMPTY_PROPERTY, null, null);
- insertProperty(3, VALUE_SIZE_4000, null, null);
- insertProperty(4, VALUE_SIZE_4001, null, null);
-
- underTest.execute();
-
- assertThat(dbTester.countRowsOfTable("properties")).isEqualTo(4);
- assertThat(dbTester.countRowsOfTable("properties2")).isEqualTo(4);
-
- assertThatProperty2(1)
- .hasNoResourceId()
- .hasNoUserId()
- .hasTextValue(VALUE_SMALL)
- .hasCreatedAt(DATE_1);
- assertThatProperty2(2)
- .hasNoResourceId()
- .hasNoUserId()
- .isEmpty()
- .hasCreatedAt(DATE_2);
- assertThatProperty2(3)
- .hasNoResourceId()
- .hasNoUserId()
- .hasTextValue(VALUE_SIZE_4000)
- .hasCreatedAt(DATE_3);
- assertThatProperty2(4)
- .hasNoResourceId()
- .hasNoUserId()
- .hasClobValue(VALUE_SIZE_4001)
- .hasCreatedAt(DATE_4);
- }
-
- @Test
- public void migration_moves_user_properties() throws SQLException {
- when(system2.now()).thenReturn(DATE_1, DATE_2, DATE_3, DATE_4);
-
- insertProperty(1, VALUE_SMALL, null, 11);
- insertProperty(2, EMPTY_PROPERTY, null, 12);
- insertProperty(3, VALUE_SIZE_4000, null, 13);
- insertProperty(4, VALUE_SIZE_4001, null, 14);
-
- underTest.execute();
-
- assertThat(dbTester.countRowsOfTable("properties")).isEqualTo(4);
- assertThat(dbTester.countRowsOfTable("properties2")).isEqualTo(4);
-
- assertThatProperty2(1)
- .hasNoResourceId()
- .hasUserId(11)
- .hasTextValue(VALUE_SMALL)
- .hasCreatedAt(DATE_1);
- assertThatProperty2(2)
- .hasNoResourceId()
- .hasUserId(12)
- .isEmpty()
- .hasCreatedAt(DATE_2);
- assertThatProperty2(3)
- .hasNoResourceId()
- .hasUserId(13)
- .hasTextValue(VALUE_SIZE_4000)
- .hasCreatedAt(DATE_3);
- assertThatProperty2(4)
- .hasNoResourceId()
- .hasUserId(14)
- .hasClobValue(VALUE_SIZE_4001)
- .hasCreatedAt(DATE_4);
- }
-
- @Test
- public void migration_moves_component_properties() throws SQLException {
- when(system2.now()).thenReturn(DATE_1, DATE_2, DATE_3, DATE_4);
-
- insertProperty(1, VALUE_SMALL, 11, null);
- insertProperty(2, EMPTY_PROPERTY, 12, null);
- insertProperty(3, VALUE_SIZE_4000, 13, null);
- insertProperty(4, VALUE_SIZE_4001, 14, null);
-
- underTest.execute();
-
- assertThat(dbTester.countRowsOfTable("properties")).isEqualTo(4);
- assertThat(dbTester.countRowsOfTable("properties2")).isEqualTo(4);
-
- assertThatProperty2(1)
- .hasResourceId(11)
- .hasNoUserId()
- .hasTextValue(VALUE_SMALL)
- .hasCreatedAt(DATE_1);
- assertThatProperty2(2)
- .hasResourceId(12)
- .hasNoUserId()
- .isEmpty()
- .hasCreatedAt(DATE_2);
- assertThatProperty2(3)
- .hasResourceId(13)
- .hasNoUserId()
- .hasTextValue(VALUE_SIZE_4000)
- .hasCreatedAt(DATE_3);
- assertThatProperty2(4)
- .hasResourceId(14)
- .hasNoUserId()
- .hasClobValue(VALUE_SIZE_4001)
- .hasCreatedAt(DATE_4);
- }
-
- private void insertProperty(int idAndKey, String value, @Nullable Integer resourceId, @Nullable Integer userId) {
- dbTester.executeInsert("PROPERTIES",
- "id", valueOf(idAndKey),
- "prop_key", valueOf(idAndKey),
- "text_value", value,
- "resource_id", resourceId == null ? null : valueOf(resourceId),
- "user_id", userId == null ? null : valueOf(userId));
- dbTester.commit();
- }
-
- private void insertProperty2(int idAndKey, @Nullable String value, @Nullable Integer resourceId, @Nullable Integer userId) {
- dbTester.executeInsert("PROPERTIES2",
- "id", valueOf(idAndKey),
- "prop_key", valueOf(idAndKey),
- "resource_id", resourceId == null ? null : valueOf(resourceId),
- "user_id", userId == null ? null : valueOf(userId),
- "is_empty", valueOf(value == null || value.isEmpty()),
- "text_value", value != null && value.length() <= 4000 ? value : null,
- "clob_value", value != null && value.length() > 4000 ? value : null,
- "created_at", valueOf(1_55555_555));
- dbTester.commit();
- }
-
- private Property2Assert assertThatProperty2(int key) {
- return new Property2Assert(dbTester, dbTester.getSession(), valueOf(key));
- }
-
- private static class Property2Assert extends AbstractAssert<Property2Assert, Property2> {
-
- private Property2Assert(DbTester dbTester, DbSession dbSession, String internalPropertyKey) {
- super(asInternalProperty(dbTester, dbSession, internalPropertyKey), Property2Assert.class);
- }
-
- private static Property2 asInternalProperty(DbTester dbTester, DbSession dbSession, String key) {
- Map<String, Object> row = dbTester.selectFirst(
- dbSession,
- "select" +
- " user_id as \"userId\", resource_id as \"resourceId\", is_empty as \"isEmpty\", text_value as \"textValue\", clob_value as \"clobValue\", created_at as \"createdAt\"" +
- " from properties2" +
- " where prop_key='" + key + "'");
- return new Property2(
- (Long) row.get("userId"),
- (Long) row.get("resourceId"),
- isEmpty(row),
- (String) row.get("textValue"),
- (String) row.get("clobValue"),
- (Long) row.get("createdAt"));
- }
-
- private static Boolean isEmpty(Map<String, Object> row) {
- Object flag = row.get("isEmpty");
- if (flag instanceof Boolean) {
- return (Boolean) flag;
- }
- if (flag instanceof Long) {
- Long longBoolean = (Long) flag;
- return longBoolean.equals(1L);
- }
- throw new IllegalArgumentException("Unsupported object type returned for column \"isEmpty\": " + flag.getClass());
- }
-
- public Property2Assert hasNoUserId() {
- isNotNull();
-
- if (actual.getUserId() != null) {
- failWithMessage("Expected Property2 to have column USER_ID to be null but was <%s>", actual.getUserId());
- }
-
- return this;
- }
-
- public Property2Assert hasUserId(long expected) {
- isNotNull();
-
- if (!Objects.equals(actual.getUserId(), expected)) {
- failWithMessage("Expected Property2 to have column USER_ID to be <%s> but was <%s>", true, actual.getUserId());
- }
-
- return this;
- }
-
- public Property2Assert hasNoResourceId() {
- isNotNull();
-
- if (actual.getResourceId() != null) {
- failWithMessage("Expected Property2 to have column RESOURCE_ID to be null but was <%s>", actual.getResourceId());
- }
-
- return this;
- }
-
- public Property2Assert hasResourceId(long expected) {
- isNotNull();
-
- if (!Objects.equals(actual.getResourceId(), expected)) {
- failWithMessage("Expected Property2 to have column RESOURCE_ID to be <%s> but was <%s>", true, actual.getResourceId());
- }
-
- return this;
- }
-
- public Property2Assert isEmpty() {
- isNotNull();
-
- if (!Objects.equals(actual.getEmpty(), TRUE)) {
- failWithMessage("Expected Property2 to have column IS_EMPTY to be <%s> but was <%s>", true, actual.getEmpty());
- }
- if (actual.getTextValue() != null) {
- failWithMessage("Expected Property2 to have column TEXT_VALUE to be null but was <%s>", actual.getTextValue());
- }
- if (actual.getClobValue() != null) {
- failWithMessage("Expected Property2 to have column CLOB_VALUE to be null but was <%s>", actual.getClobValue());
- }
-
- return this;
- }
-
- public Property2Assert hasTextValue(String expected) {
- isNotNull();
-
- if (!Objects.equals(actual.getTextValue(), requireNonNull(expected))) {
- failWithMessage("Expected Property2 to have column TEXT_VALUE to be <%s> but was <%s>", expected, actual.getTextValue());
- }
- if (actual.getClobValue() != null) {
- failWithMessage("Expected Property2 to have column CLOB_VALUE to be null but was <%s>", actual.getClobValue());
- }
- if (!Objects.equals(actual.getEmpty(), FALSE)) {
- failWithMessage("Expected Property2 to have column IS_EMPTY to be <%s> but was <%s>", false, actual.getEmpty());
- }
-
- return this;
- }
-
- public Property2Assert hasClobValue(String expected) {
- isNotNull();
-
- if (!Objects.equals(actual.getClobValue(), requireNonNull(expected))) {
- failWithMessage("Expected Property2 to have column CLOB_VALUE to be <%s> but was <%s>", expected, actual.getClobValue());
- }
- if (actual.getTextValue() != null) {
- failWithMessage("Expected Property2 to have column TEXT_VALUE to be null but was <%s>", actual.getTextValue());
- }
- if (!Objects.equals(actual.getEmpty(), FALSE)) {
- failWithMessage("Expected Property2 to have column IS_EMPTY to be <%s> but was <%s>", false, actual.getEmpty());
- }
-
- return this;
- }
-
- public Property2Assert hasCreatedAt(long expected) {
- isNotNull();
-
- if (!Objects.equals(actual.getCreatedAt(), expected)) {
- failWithMessage("Expected Property2 to have column CREATED_AT to be <%s> but was <%s>", expected, actual.getCreatedAt());
- }
-
- return this;
- }
-
- }
-
- private static final class Property2 {
- private final Long userId;
- private final Long resourceId;
- private final Boolean empty;
- private final String textValue;
- private final String clobValue;
- private final Long createdAt;
-
- private Property2(@Nullable Long userId, @Nullable Long resourceId,
- @Nullable Boolean empty, @Nullable String textValue, @Nullable String clobValue,
- @Nullable Long createdAt) {
- this.userId = userId;
- this.resourceId = resourceId;
- this.empty = empty;
- this.textValue = textValue;
- this.clobValue = clobValue;
- this.createdAt = createdAt;
- }
-
- public Long getUserId() {
- return userId;
- }
-
- public Long getResourceId() {
- return resourceId;
- }
-
- @CheckForNull
- public Boolean getEmpty() {
- return empty;
- }
-
- @CheckForNull
- public String getTextValue() {
- return textValue;
- }
-
- @CheckForNull
- public String getClobValue() {
- return clobValue;
- }
-
- @CheckForNull
- public Long getCreatedAt() {
- return createdAt;
- }
- }
-}
diff --git a/sonar-db/src/test/java/org/sonar/db/version/v61/RemoveViewsDefinitionFromPropertiesTest.java b/sonar-db/src/test/java/org/sonar/db/version/v61/RemoveViewsDefinitionFromPropertiesTest.java
deleted file mode 100644
index bcabb800230..00000000000
--- a/sonar-db/src/test/java/org/sonar/db/version/v61/RemoveViewsDefinitionFromPropertiesTest.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2016 SonarSource SA
- * mailto:contact 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.db.version.v61;
-
-import java.sql.SQLException;
-import java.util.List;
-import java.util.Map;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-import org.sonar.api.utils.System2;
-import org.sonar.db.DbTester;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.mockito.Mockito.spy;
-import static org.mockito.Mockito.when;
-
-public class RemoveViewsDefinitionFromPropertiesTest {
-
- private static final long NOW = 1_500_000_000_000L;
-
- @Rule
- public ExpectedException expectedException = ExpectedException.none();
- @Rule
- public DbTester db = DbTester.createForSchema(System2.INSTANCE, RemoveViewsDefinitionFromPropertiesTest.class, "properties_and_internal_properties.sql");
-
- private System2 system2 = spy(System2.INSTANCE);
- private RemoveViewsDefinitionFromProperties underTest = new RemoveViewsDefinitionFromProperties(db.database(), system2);
-
- @Test
- public void ignore_missing_views_definition() throws SQLException {
- underTest.execute();
-
- assertThat(db.countRowsOfTable("internal_properties")).isEqualTo(0);
- }
-
- @Test
- public void move_views_definition_from_properties_to_text_value_of_internal_properties_table_when_less_than_4000() throws SQLException {
- executeAndVerify("views content", false);
- }
-
- @Test
- public void move_views_definition_from_properties_to_text_value_of_internal_properties_table_when_is_4000() throws SQLException {
- executeAndVerify(String.format("%1$4000.4000s", "*"), false);
- }
-
- @Test
- public void move_views_definition_from_properties_to_clob_value_of_internal_properties_table_when_is_more_than_4000() throws SQLException {
- executeAndVerify(String.format("%1$4000.4000s", "*") + "abc", true);
- }
-
- private void executeAndVerify(String xml, boolean isClob) throws SQLException {
- when(system2.now()).thenReturn(NOW);
- db.executeInsert("properties", "prop_key", "views.def", "text_value", xml);
- db.executeInsert("properties", "prop_key", "other.property", "text_value", "other content");
-
- underTest.execute();
-
- assertThat(db.countRowsOfTable("internal_properties")).isEqualTo(1);
- Map<String, Object> internalProp = db.selectFirst("select" +
- " kee as \"key\", is_empty as \"isEmpty\", text_value as \"textValue\", clob_value as \"clobValue\", created_at as \"createdAt\"" +
- " from internal_properties");
- assertThat(internalProp.get("key")).isEqualTo("views.def");
- assertThat(internalProp.get("isEmpty")).isEqualTo(false);
- if (isClob) {
- assertThat(internalProp.get("clobValue")).isEqualTo(xml);
- assertThat(internalProp.get("textValue")).isNull();
- } else {
- assertThat(internalProp.get("textValue")).isEqualTo(xml);
- assertThat(internalProp.get("clobValue")).isNull();
- }
- assertThat(internalProp.get("createdAt")).isEqualTo(NOW);
-
- // property "views.def" has been deleted
- List<Map<String, Object>> properties = db.select("select prop_key as \"prop_key\" from properties");
- assertThat(properties).hasSize(1);
- assertThat(properties.get(0).get("prop_key")).isEqualTo("other.property");
- }
-
-}
diff --git a/sonar-db/src/test/resources/org/sonar/db/version/v61/AddErrorColumnsToCeActivityTest/old_ce_activity.sql b/sonar-db/src/test/resources/org/sonar/db/version/v61/AddErrorColumnsToCeActivityTest/old_ce_activity.sql
deleted file mode 100644
index a519e005821..00000000000
--- a/sonar-db/src/test/resources/org/sonar/db/version/v61/AddErrorColumnsToCeActivityTest/old_ce_activity.sql
+++ /dev/null
@@ -1,17 +0,0 @@
-CREATE TABLE "CE_ACTIVITY" (
- "ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1),
- "UUID" VARCHAR(40) NOT NULL,
- "TASK_TYPE" VARCHAR(15) NOT NULL,
- "COMPONENT_UUID" VARCHAR(40) NULL,
- "ANALYSIS_UUID" VARCHAR(50) NULL,
- "STATUS" VARCHAR(15) NOT NULL,
- "IS_LAST" BOOLEAN NOT NULL,
- "IS_LAST_KEY" VARCHAR(55) NOT NULL,
- "SUBMITTER_LOGIN" VARCHAR(255) NULL,
- "SUBMITTED_AT" BIGINT NOT NULL,
- "STARTED_AT" BIGINT NULL,
- "EXECUTED_AT" BIGINT NULL,
- "CREATED_AT" BIGINT NOT NULL,
- "UPDATED_AT" BIGINT NOT NULL,
- "EXECUTION_TIME_MS" BIGINT NULL
-);
diff --git a/sonar-db/src/test/resources/org/sonar/db/version/v61/CopyActivitiesToQprofileChangesTest/schema.sql b/sonar-db/src/test/resources/org/sonar/db/version/v61/CopyActivitiesToQprofileChangesTest/schema.sql
deleted file mode 100644
index 8f8df334379..00000000000
--- a/sonar-db/src/test/resources/org/sonar/db/version/v61/CopyActivitiesToQprofileChangesTest/schema.sql
+++ /dev/null
@@ -1,22 +0,0 @@
-CREATE TABLE "ACTIVITIES" (
- "ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1),
- "LOG_KEY" VARCHAR(250),
- "PROFILE_KEY" VARCHAR(255) NOT NULL,
- "CREATED_AT" TIMESTAMP,
- "USER_LOGIN" VARCHAR(255),
- "LOG_TYPE" VARCHAR(250),
- "LOG_ACTION" VARCHAR(250),
- "LOG_MESSAGE" VARCHAR(250),
- "DATA_FIELD" CLOB(2147483647)
-);
-CREATE UNIQUE INDEX "ACTIVITIES_LOG_KEY" ON "ACTIVITIES" ("LOG_KEY");
-
-CREATE TABLE "QPROFILE_CHANGES" (
- "KEE" VARCHAR(40) NOT NULL PRIMARY KEY,
- "QPROFILE_KEY" VARCHAR(255) NOT NULL,
- "CHANGE_TYPE" VARCHAR(20) NOT NULL,
- "CREATED_AT" BIGINT NOT NULL,
- "USER_LOGIN" VARCHAR(255),
- "CHANGE_DATA" CLOB
-);
-CREATE INDEX "QPROFILE_CHANGES_QPROFILE_KEY" ON "QPROFILE_CHANGES" ("QPROFILE_KEY");
diff --git a/sonar-db/src/test/resources/org/sonar/db/version/v61/CreateTableCeTaskInputTest/empty.sql b/sonar-db/src/test/resources/org/sonar/db/version/v61/CreateTableCeTaskInputTest/empty.sql
deleted file mode 100644
index e69de29bb2d..00000000000
--- a/sonar-db/src/test/resources/org/sonar/db/version/v61/CreateTableCeTaskInputTest/empty.sql
+++ /dev/null
diff --git a/sonar-db/src/test/resources/org/sonar/db/version/v61/CreateTableInternalPropertiesTest/empty.sql b/sonar-db/src/test/resources/org/sonar/db/version/v61/CreateTableInternalPropertiesTest/empty.sql
deleted file mode 100644
index e69de29bb2d..00000000000
--- a/sonar-db/src/test/resources/org/sonar/db/version/v61/CreateTableInternalPropertiesTest/empty.sql
+++ /dev/null
diff --git a/sonar-db/src/test/resources/org/sonar/db/version/v61/CreateTableProperties2Test/empty.sql b/sonar-db/src/test/resources/org/sonar/db/version/v61/CreateTableProperties2Test/empty.sql
deleted file mode 100644
index e69de29bb2d..00000000000
--- a/sonar-db/src/test/resources/org/sonar/db/version/v61/CreateTableProperties2Test/empty.sql
+++ /dev/null
diff --git a/sonar-db/src/test/resources/org/sonar/db/version/v61/CreateTableQprofileChangesTest/empty.sql b/sonar-db/src/test/resources/org/sonar/db/version/v61/CreateTableQprofileChangesTest/empty.sql
deleted file mode 100644
index e69de29bb2d..00000000000
--- a/sonar-db/src/test/resources/org/sonar/db/version/v61/CreateTableQprofileChangesTest/empty.sql
+++ /dev/null
diff --git a/sonar-db/src/test/resources/org/sonar/db/version/v61/CreateTableRuleRepositoriesTest/empty.sql b/sonar-db/src/test/resources/org/sonar/db/version/v61/CreateTableRuleRepositoriesTest/empty.sql
deleted file mode 100644
index e69de29bb2d..00000000000
--- a/sonar-db/src/test/resources/org/sonar/db/version/v61/CreateTableRuleRepositoriesTest/empty.sql
+++ /dev/null
diff --git a/sonar-db/src/test/resources/org/sonar/db/version/v61/DeleteProjectDashboardsTest/schema.sql b/sonar-db/src/test/resources/org/sonar/db/version/v61/DeleteProjectDashboardsTest/schema.sql
deleted file mode 100644
index 1030e93bff0..00000000000
--- a/sonar-db/src/test/resources/org/sonar/db/version/v61/DeleteProjectDashboardsTest/schema.sql
+++ /dev/null
@@ -1,39 +0,0 @@
-CREATE TABLE "DASHBOARDS" (
- "ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1),
- "USER_ID" INTEGER,
- "NAME" VARCHAR(256),
- "DESCRIPTION" VARCHAR(1000),
- "COLUMN_LAYOUT" VARCHAR(20),
- "SHARED" BOOLEAN,
- "IS_GLOBAL" BOOLEAN,
- "CREATED_AT" TIMESTAMP,
- "UPDATED_AT" TIMESTAMP
-);
-
-CREATE TABLE "ACTIVE_DASHBOARDS" (
- "ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1),
- "DASHBOARD_ID" INTEGER NOT NULL,
- "USER_ID" INTEGER,
- "ORDER_INDEX" INTEGER
-);
-
-CREATE TABLE "WIDGETS" (
- "ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1),
- "DASHBOARD_ID" INTEGER NOT NULL,
- "WIDGET_KEY" VARCHAR(256) NOT NULL,
- "NAME" VARCHAR(256),
- "DESCRIPTION" VARCHAR(1000),
- "COLUMN_INDEX" INTEGER,
- "ROW_INDEX" INTEGER,
- "CONFIGURED" BOOLEAN,
- "CREATED_AT" TIMESTAMP,
- "UPDATED_AT" TIMESTAMP,
- "RESOURCE_ID" INTEGER
-);
-
-CREATE TABLE "WIDGET_PROPERTIES" (
- "ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1),
- "WIDGET_ID" INTEGER NOT NULL,
- "KEE" VARCHAR(100),
- "TEXT_VALUE" VARCHAR(4000)
-);
diff --git a/sonar-db/src/test/resources/org/sonar/db/version/v61/DeleteReportsFromCeQueueTest/schema.sql b/sonar-db/src/test/resources/org/sonar/db/version/v61/DeleteReportsFromCeQueueTest/schema.sql
deleted file mode 100644
index 2b74746090d..00000000000
--- a/sonar-db/src/test/resources/org/sonar/db/version/v61/DeleteReportsFromCeQueueTest/schema.sql
+++ /dev/null
@@ -1,11 +0,0 @@
-CREATE TABLE "CE_QUEUE" (
- "ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1),
- "UUID" VARCHAR(40) NOT NULL,
- "TASK_TYPE" VARCHAR(15) NOT NULL,
- "COMPONENT_UUID" VARCHAR(40) NULL,
- "STATUS" VARCHAR(15) NOT NULL,
- "SUBMITTER_LOGIN" VARCHAR(255) NULL,
- "STARTED_AT" BIGINT NULL,
- "CREATED_AT" BIGINT NOT NULL,
- "UPDATED_AT" BIGINT NOT NULL
-);
diff --git a/sonar-db/src/test/resources/org/sonar/db/version/v61/PopulateTableProperties2Test/properties_and_properties_2_tables.sql b/sonar-db/src/test/resources/org/sonar/db/version/v61/PopulateTableProperties2Test/properties_and_properties_2_tables.sql
deleted file mode 100644
index 9781eda6197..00000000000
--- a/sonar-db/src/test/resources/org/sonar/db/version/v61/PopulateTableProperties2Test/properties_and_properties_2_tables.sql
+++ /dev/null
@@ -1,20 +0,0 @@
-CREATE TABLE "PROPERTIES" (
- "ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1),
- "PROP_KEY" VARCHAR(512),
- "RESOURCE_ID" INTEGER,
- "TEXT_VALUE" CLOB(2147483647),
- "USER_ID" INTEGER
-);
-CREATE INDEX "PROPERTIES_KEY" ON "PROPERTIES" ("PROP_KEY");
-
-CREATE TABLE "PROPERTIES2" (
- "ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1),
- "PROP_KEY" VARCHAR(512) NOT NULL,
- "RESOURCE_ID" INTEGER,
- "USER_ID" INTEGER,
- "IS_EMPTY" BOOLEAN NOT NULL,
- "TEXT_VALUE" VARCHAR(4000),
- "CLOB_VALUE" CLOB(2147483647),
- "CREATED_AT" BIGINT
-);
-CREATE INDEX "PROPERTIES2_KEY" ON "PROPERTIES2" ("PROP_KEY");
diff --git a/sonar-db/src/test/resources/org/sonar/db/version/v61/RemoveViewsDefinitionFromPropertiesTest/properties_and_internal_properties.sql b/sonar-db/src/test/resources/org/sonar/db/version/v61/RemoveViewsDefinitionFromPropertiesTest/properties_and_internal_properties.sql
deleted file mode 100644
index e38510f469a..00000000000
--- a/sonar-db/src/test/resources/org/sonar/db/version/v61/RemoveViewsDefinitionFromPropertiesTest/properties_and_internal_properties.sql
+++ /dev/null
@@ -1,17 +0,0 @@
-CREATE TABLE "PROPERTIES" (
- "ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1),
- "PROP_KEY" VARCHAR(512),
- "RESOURCE_ID" INTEGER,
- "TEXT_VALUE" CLOB(2147483647),
- "USER_ID" INTEGER
-);
-
-CREATE TABLE "INTERNAL_PROPERTIES" (
- "KEE" VARCHAR(50) NOT NULL PRIMARY KEY,
- "IS_EMPTY" BOOLEAN NOT NULL,
- "TEXT_VALUE" VARCHAR(4000),
- "CLOB_VALUE" CLOB,
- "CREATED_AT" BIGINT
-);
-
-CREATE UNIQUE INDEX "UNIQ_INTERNAL_PROPERTIES" ON "INTERNAL_PROPERTIES" ("KEE");