From bbda3cfd4c3463509430a0d9cf4e283167c9769a Mon Sep 17 00:00:00 2001 From: =?utf8?q?S=C3=A9bastien=20Lesaint?= Date: Tue, 19 Jan 2016 19:04:58 +0100 Subject: [PATCH] add index on project_measures.person_id --- .../1010_add_index_measures_person_id.rb | 30 +++++++++++++++++++ .../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, 34 insertions(+), 1 deletion(-) create mode 100644 server/sonar-web/src/main/webapp/WEB-INF/db/migrate/1010_add_index_measures_person_id.rb diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/1010_add_index_measures_person_id.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/1010_add_index_measures_person_id.rb new file mode 100644 index 00000000000..091d678afbb --- /dev/null +++ b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/1010_add_index_measures_person_id.rb @@ -0,0 +1,30 @@ +# +# 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.4 +# +class AddIndexMeasuresPersonId < ActiveRecord::Migration + + def self.up + add_index :project_measures, :person_id, :name => 'measures_person' + 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 4593d40db8c..b5f895b29ab 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 = 1009; + public static final int LAST_VERSION = 1010; /** * 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 775d65c4fe3..c629c8113d2 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 @@ -371,6 +371,7 @@ INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('1006'); INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('1007'); INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('1008'); INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('1009'); +INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('1010'); 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 42a3c21d3e9..0db4c0881af 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 @@ -589,6 +589,8 @@ CREATE UNIQUE INDEX "GROUPS_USERS_UNIQUE" ON "GROUPS_USERS" ("GROUP_ID", "USER_I CREATE INDEX "MEASURES_SID_METRIC" ON "PROJECT_MEASURES" ("SNAPSHOT_ID", "METRIC_ID"); +CREATE INDEX "MEASURES_PERSON" ON "PROJECT_MEASURES" ("PERSON_ID"); + CREATE UNIQUE INDEX "METRICS_UNIQUE_NAME" ON "METRICS" ("NAME"); CREATE INDEX "EVENTS_SNAPSHOT_ID" ON "EVENTS" ("SNAPSHOT_ID"); -- 2.39.5