From 93598d6f84ba12c14150f160604605c68b568272 Mon Sep 17 00:00:00 2001 From: Julien Lancelot Date: Thu, 7 Jan 2016 10:23:09 +0100 Subject: [PATCH] SONAR-7176 Add index on CE_QUEUE.COMPONENT_UUID --- ...07_add_index_on_ce_queue_component_uuid.rb | 33 +++++++++++++++++++ .../org/sonar/db/version/DatabaseVersion.java | 2 +- .../org/sonar/db/version/rows-h2.sql | 1 + .../org/sonar/db/version/schema-h2.ddl | 2 ++ 4 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 server/sonar-web/src/main/webapp/WEB-INF/db/migrate/1007_add_index_on_ce_queue_component_uuid.rb diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/1007_add_index_on_ce_queue_component_uuid.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/1007_add_index_on_ce_queue_component_uuid.rb new file mode 100644 index 00000000000..77646e25d8b --- /dev/null +++ b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/1007_add_index_on_ce_queue_component_uuid.rb @@ -0,0 +1,33 @@ +# +# 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.3 +# SONAR-7176 +# +class AddIndexOnCeQueueComponentUuid < ActiveRecord::Migration + + def self.up + add_index :ce_queue, :component_uuid, :name => 'ce_queue_component_uuid' + 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 85915c7b673..86084385665 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 @@ -29,7 +29,7 @@ import org.sonar.db.MyBatis; public class DatabaseVersion { - public static final int LAST_VERSION = 1006; + public static final int LAST_VERSION = 1007; /** * The minimum supported version which can be upgraded. Lower 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 363a767dccd..4de613385f4 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 @@ -367,6 +367,7 @@ INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('1003'); INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('1004'); INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('1005'); INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('1006'); +INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('1007'); INSERT INTO USERS(ID, LOGIN, NAME, EMAIL, CRYPTED_PASSWORD, SALT, CREATED_AT, UPDATED_AT, REMEMBER_TOKEN, REMEMBER_TOKEN_EXPIRES_AT) VALUES (1, 'admin', 'Administrator', '', 'a373a0e667abb2604c1fd571eb4ad47fe8cc0878', '48bc4b0d93179b5103fd3885ea9119498e9d161b', '1418215735482', '1418215735482', null, null); ALTER TABLE USERS ALTER COLUMN ID RESTART WITH 2; diff --git a/sonar-db/src/main/resources/org/sonar/db/version/schema-h2.ddl b/sonar-db/src/main/resources/org/sonar/db/version/schema-h2.ddl index 036d03b4c69..42a3c21d3e9 100644 --- a/sonar-db/src/main/resources/org/sonar/db/version/schema-h2.ddl +++ b/sonar-db/src/main/resources/org/sonar/db/version/schema-h2.ddl @@ -705,6 +705,8 @@ CREATE UNIQUE INDEX "UNIQ_PROJECT_QPROFILES" ON "PROJECT_QPROFILES" ("PROJECT_UU CREATE UNIQUE INDEX "CE_QUEUE_UUID" ON "CE_QUEUE" ("UUID"); +CREATE INDEX "CE_QUEUE_COMPONENT_UUID" ON "CE_QUEUE" ("COMPONENT_UUID"); + CREATE UNIQUE INDEX "CE_ACTIVITY_UUID" ON "CE_ACTIVITY" ("UUID"); CREATE INDEX "CE_ACTIVITY_COMPONENT_UUID" ON "CE_ACTIVITY" ("COMPONENT_UUID"); -- 2.39.5