aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJulien Lancelot <julien.lancelot@sonarsource.com>2014-10-20 12:05:54 +0200
committerJulien Lancelot <julien.lancelot@sonarsource.com>2014-10-20 12:05:54 +0200
commitdc0ef8c3e87322b7beeddf11fd084788b6755747 (patch)
treedd3ec4de736439cf6d3ec2d798b44064e62dea7b
parent4b389949b73baf05e15c007be6ba7ea611a86091 (diff)
downloadsonarqube-dc0ef8c3e87322b7beeddf11fd084788b6755747.tar.gz
sonarqube-dc0ef8c3e87322b7beeddf11fd084788b6755747.zip
SONAR-5625 Include the "enabled" column to the current "projects_kee" index
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/db/migrate/603_add_enabled_to_projects_kee_index.rb39
-rw-r--r--sonar-core/src/main/java/org/sonar/core/persistence/DatabaseVersion.java2
-rw-r--r--sonar-core/src/main/resources/org/sonar/core/persistence/rows-h2.sql1
-rw-r--r--sonar-core/src/main/resources/org/sonar/core/persistence/schema-h2.ddl2
4 files changed, 42 insertions, 2 deletions
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");