From: Julien Lancelot Date: Mon, 20 Oct 2014 10:05:54 +0000 (+0200) Subject: SONAR-5625 Include the "enabled" column to the current "projects_kee" index X-Git-Tag: 4.5.1-RC1~20 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=dc0ef8c3e87322b7beeddf11fd084788b6755747;p=sonarqube.git SONAR-5625 Include the "enabled" column to the current "projects_kee" index --- diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/603_add_enabled_to_projects_kee_index.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/603_add_enabled_to_projects_kee_index.rb new file mode 100644 index 00000000000..6615bc274d2 --- /dev/null +++ b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/603_add_enabled_to_projects_kee_index.rb @@ -0,0 +1,39 @@ +# +# 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 4.5 +# SONAR-5625 +# +class AddEnabledToProjectsKeeIndex < ActiveRecord::Migration + + def self.up + remove_index :projects, :name => 'projects_kee' + + if dialect=='mysql' + # Index of varchar column is limited to 767 bytes on mysql (<= 255 UTF-8 characters) + # See http://jira.codehaus.org/browse/SONAR-4137 and + # http://dev.mysql.com/doc/refman/5.6/en/innodb-restrictions.html + add_index :projects, [:kee, :enabled], :name => 'projects_kee', :length => {:kee => 255} + else + add_index :projects, [:kee, :enabled], :name => 'projects_kee' + end + end +end diff --git a/sonar-core/src/main/java/org/sonar/core/persistence/DatabaseVersion.java b/sonar-core/src/main/java/org/sonar/core/persistence/DatabaseVersion.java index 9045874e393..f8efc2cf9d3 100644 --- a/sonar-core/src/main/java/org/sonar/core/persistence/DatabaseVersion.java +++ b/sonar-core/src/main/java/org/sonar/core/persistence/DatabaseVersion.java @@ -33,7 +33,7 @@ import java.util.List; */ public class DatabaseVersion implements BatchComponent, ServerComponent { - public static final int LAST_VERSION = 602; + public static final int LAST_VERSION = 603; public static enum Status { UP_TO_DATE, REQUIRES_UPGRADE, REQUIRES_DOWNGRADE, FRESH_INSTALL diff --git a/sonar-core/src/main/resources/org/sonar/core/persistence/rows-h2.sql b/sonar-core/src/main/resources/org/sonar/core/persistence/rows-h2.sql index 7987b78321e..1539b72a142 100644 --- a/sonar-core/src/main/resources/org/sonar/core/persistence/rows-h2.sql +++ b/sonar-core/src/main/resources/org/sonar/core/persistence/rows-h2.sql @@ -257,6 +257,7 @@ INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('584'); INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('600'); INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('601'); INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('602'); +INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('603'); 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', '2011-09-26 22:27:48.0', '2011-09-26 22:27:48.0', null, null); ALTER TABLE USERS ALTER COLUMN ID RESTART WITH 2; diff --git a/sonar-core/src/main/resources/org/sonar/core/persistence/schema-h2.ddl b/sonar-core/src/main/resources/org/sonar/core/persistence/schema-h2.ddl index d3c9a53a3e4..0afd7195b6e 100644 --- a/sonar-core/src/main/resources/org/sonar/core/persistence/schema-h2.ddl +++ b/sonar-core/src/main/resources/org/sonar/core/persistence/schema-h2.ddl @@ -614,7 +614,7 @@ CREATE INDEX "PROPERTIES_KEY" ON "PROPERTIES" ("PROP_KEY"); CREATE INDEX "MANUAL_MEASURES_RESOURCE_ID" ON "MANUAL_MEASURES" ("RESOURCE_ID"); -CREATE INDEX "PROJECTS_KEE" ON "PROJECTS" ("KEE"); +CREATE INDEX "PROJECTS_KEE" ON "PROJECTS" ("KEE", "ENABLED"); CREATE INDEX "PROJECTS_ROOT_ID" ON "PROJECTS" ("ROOT_ID");