From: Sébastien Lesaint Date: Wed, 15 Feb 2017 17:41:37 +0000 (+0100) Subject: SONAR-8728 do index create/drop in dedicated Ruby migrations X-Git-Tag: 5.6.6~1 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=e8e13145497bb920921ae4fe11b09f0903f1d298;p=sonarqube.git SONAR-8728 do index create/drop in dedicated Ruby migrations --- diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/1154_clean_usurper_root_components.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/1154_clean_usurper_root_components.rb deleted file mode 100644 index b15d00b7d13..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/1154_clean_usurper_root_components.rb +++ /dev/null @@ -1,34 +0,0 @@ -# -# SonarQube, open source software quality management tool. -# Copyright (C) 2008-2014 SonarSource -# mailto:contact AT sonarsource DOT com -# -# SonarQube 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. -# -# SonarQube 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. -# - -# -# SonarQube 5.6.4 -# SONAR-8454 -# -class CleanUsurperRootComponents < ActiveRecord::Migration - - def self.up - add_index 'project_measures', 'project_id', :name => 'tmp_measures_project_id' - execute_java_migration('org.sonar.db.version.v564.FixProjectUuidOfDeveloperProjects') - execute_java_migration('org.sonar.db.version.v564.CleanUsurperRootComponents') - remove_index 'project_measures', :name => 'tmp_measures_project_id' - end - -end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/1155_add_index_project_measures.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/1155_add_index_project_measures.rb new file mode 100644 index 00000000000..b694eaf27ca --- /dev/null +++ b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/1155_add_index_project_measures.rb @@ -0,0 +1,31 @@ +# +# SonarQube, open source software quality management tool. +# Copyright (C) 2008-2014 SonarSource +# mailto:contact AT sonarsource DOT com +# +# SonarQube 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. +# +# SonarQube 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. +# + +# +# SonarQube 5.6.6 +# SONAR-8454 +# +class AddIndexProjectMeasures < ActiveRecord::Migration + + def self.up + add_index 'project_measures', 'project_id', :name => 'tmp_measures_project_id' + end + +end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/1156_clean_usurper_root_components.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/1156_clean_usurper_root_components.rb new file mode 100644 index 00000000000..2fc8501cfbc --- /dev/null +++ b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/1156_clean_usurper_root_components.rb @@ -0,0 +1,32 @@ +# +# SonarQube, open source software quality management tool. +# Copyright (C) 2008-2014 SonarSource +# mailto:contact AT sonarsource DOT com +# +# SonarQube 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. +# +# SonarQube 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. +# + +# +# SonarQube 5.6.6 +# SONAR-8454 +# +class CleanUsurperRootComponents < ActiveRecord::Migration + + def self.up + execute_java_migration('org.sonar.db.version.v564.FixProjectUuidOfDeveloperProjects') + execute_java_migration('org.sonar.db.version.v564.CleanUsurperRootComponents') + end + +end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/1157_drop_index_project_measures.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/1157_drop_index_project_measures.rb new file mode 100644 index 00000000000..7073cd6982d --- /dev/null +++ b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/1157_drop_index_project_measures.rb @@ -0,0 +1,31 @@ +# +# SonarQube, open source software quality management tool. +# Copyright (C) 2008-2014 SonarSource +# mailto:contact AT sonarsource DOT com +# +# SonarQube 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. +# +# SonarQube 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. +# + +# +# SonarQube 5.6.6 +# SONAR-8454 +# +class DropIndexProjectMeasures < ActiveRecord::Migration + + def self.up + remove_index 'project_measures', :name => 'tmp_measures_project_id' + end + +end diff --git a/sonar-db/src/main/java/org/sonar/db/version/DatabaseVersion.java b/sonar-db/src/main/java/org/sonar/db/version/DatabaseVersion.java index 4c2266f0c1e..286f7f6313e 100644 --- a/sonar-db/src/main/java/org/sonar/db/version/DatabaseVersion.java +++ b/sonar-db/src/main/java/org/sonar/db/version/DatabaseVersion.java @@ -30,7 +30,7 @@ import org.sonar.db.MyBatis; public class DatabaseVersion { - public static final int LAST_VERSION = 1_154; + public static final int LAST_VERSION = 1_157; /** * The minimum supported version which can be upgraded. Lower 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 97179941d14..5863f4beee0 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 @@ -173,6 +173,8 @@ public class MigrationStepModule extends Module { // 5.6.4 FixProjectUuidOfDeveloperProjects.class, + + // 5.6.6 CleanUsurperRootComponents.class ); } diff --git a/sonar-db/src/main/resources/org/sonar/db/version/rows-h2.sql b/sonar-db/src/main/resources/org/sonar/db/version/rows-h2.sql index d89da588e1f..5daa7046cc3 100644 --- a/sonar-db/src/main/resources/org/sonar/db/version/rows-h2.sql +++ b/sonar-db/src/main/resources/org/sonar/db/version/rows-h2.sql @@ -408,6 +408,9 @@ INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('1151'); INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('1152'); INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('1153'); INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('1154'); +INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('1155'); +INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('1156'); +INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('1157'); INSERT INTO USERS(ID, LOGIN, NAME, EMAIL, EXTERNAL_IDENTITY, EXTERNAL_IDENTITY_PROVIDER, USER_LOCAL, CRYPTED_PASSWORD, SALT, CREATED_AT, UPDATED_AT, REMEMBER_TOKEN, REMEMBER_TOKEN_EXPIRES_AT) VALUES (1, 'admin', 'Administrator', '', 'admin', 'sonarqube', true, 'a373a0e667abb2604c1fd571eb4ad47fe8cc0878', '48bc4b0d93179b5103fd3885ea9119498e9d161b', '1418215735482', '1418215735482', null, null); ALTER TABLE USERS ALTER COLUMN ID RESTART WITH 2;