From 4ff133235967c094e486f472c06ac2b625fbca90 Mon Sep 17 00:00:00 2001 From: Sébastien Lesaint Date: Mon, 12 Dec 2016 11:56:39 +0100 Subject: SONAR-8445 move SQ 6.1 migrations out of Ruby --- .../org/sonar/db/version/MigrationStepModule.java | 40 +--------- .../db/version/v61/AddBUuidPathToProjects.java | 44 ----------- .../version/v61/AddErrorColumnsToCeActivity.java | 46 ------------ .../v61/CopyActivitiesToQprofileChanges.java | 68 ----------------- .../db/version/v61/CreateTableCeTaskInput.java | 47 ------------ .../version/v61/CreateTableInternalProperties.java | 49 ------------ .../db/version/v61/CreateTableProperties2.java | 69 ----------------- .../db/version/v61/CreateTableQprofileChanges.java | 49 ------------ .../version/v61/CreateTableRuleRepositories.java | 46 ------------ .../db/version/v61/CreateTableScannerContext.java | 47 ------------ .../db/version/v61/DeleteProjectDashboards.java | 75 ------------------- .../db/version/v61/DeleteReportsFromCeQueue.java | 48 ------------ .../db/version/v61/DropIsGlobalFromDashboards.java | 41 ----------- .../sonar/db/version/v61/DropTableActivities.java | 46 ------------ .../sonar/db/version/v61/DropTableProperties.java | 46 ------------ .../db/version/v61/PopulateTableProperties2.java | 84 --------------------- .../v61/RemoveViewsDefinitionFromProperties.java | 86 ---------------------- .../v61/RenameTableProperties2ToProperties.java | 56 -------------- .../v61/ShrinkModuleUuidPathOfProjects.java | 44 ----------- .../org/sonar/db/version/v61/package-info.java | 24 ------ 20 files changed, 1 insertion(+), 1054 deletions(-) delete mode 100644 sonar-db/src/main/java/org/sonar/db/version/v61/AddBUuidPathToProjects.java delete mode 100644 sonar-db/src/main/java/org/sonar/db/version/v61/AddErrorColumnsToCeActivity.java delete mode 100644 sonar-db/src/main/java/org/sonar/db/version/v61/CopyActivitiesToQprofileChanges.java delete mode 100644 sonar-db/src/main/java/org/sonar/db/version/v61/CreateTableCeTaskInput.java delete mode 100644 sonar-db/src/main/java/org/sonar/db/version/v61/CreateTableInternalProperties.java delete mode 100644 sonar-db/src/main/java/org/sonar/db/version/v61/CreateTableProperties2.java delete mode 100644 sonar-db/src/main/java/org/sonar/db/version/v61/CreateTableQprofileChanges.java delete mode 100644 sonar-db/src/main/java/org/sonar/db/version/v61/CreateTableRuleRepositories.java delete mode 100644 sonar-db/src/main/java/org/sonar/db/version/v61/CreateTableScannerContext.java delete mode 100644 sonar-db/src/main/java/org/sonar/db/version/v61/DeleteProjectDashboards.java delete mode 100644 sonar-db/src/main/java/org/sonar/db/version/v61/DeleteReportsFromCeQueue.java delete mode 100644 sonar-db/src/main/java/org/sonar/db/version/v61/DropIsGlobalFromDashboards.java delete mode 100644 sonar-db/src/main/java/org/sonar/db/version/v61/DropTableActivities.java delete mode 100644 sonar-db/src/main/java/org/sonar/db/version/v61/DropTableProperties.java delete mode 100644 sonar-db/src/main/java/org/sonar/db/version/v61/PopulateTableProperties2.java delete mode 100644 sonar-db/src/main/java/org/sonar/db/version/v61/RemoveViewsDefinitionFromProperties.java delete mode 100644 sonar-db/src/main/java/org/sonar/db/version/v61/RenameTableProperties2ToProperties.java delete mode 100644 sonar-db/src/main/java/org/sonar/db/version/v61/ShrinkModuleUuidPathOfProjects.java delete mode 100644 sonar-db/src/main/java/org/sonar/db/version/v61/package-info.java (limited to 'sonar-db/src/main/java/org/sonar') 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 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 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 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; -- cgit v1.2.3