]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-4529 Add index on created_at column of notifications table to improve notificat...
authorJean-Baptiste Vilain <jean-baptiste.vilain@sonarsource.com>
Tue, 6 Aug 2013 09:36:02 +0000 (11:36 +0200)
committerJean-Baptiste Vilain <jean-baptiste.vilain@sonarsource.com>
Tue, 6 Aug 2013 09:36:02 +0000 (11:36 +0200)
sonar-core/src/main/java/org/sonar/core/persistence/DatabaseVersion.java
sonar-core/src/main/resources/org/sonar/core/persistence/rows-h2.sql
sonar-core/src/main/resources/org/sonar/core/persistence/schema-h2.ddl
sonar-server/src/main/webapp/WEB-INF/db/migrate/430_add_index_to_notifications_created_at.rb [new file with mode: 0644]

index c59df69feb3709369bd533f8b51161554b061c98..dc0382384d3f49c77b5cb07176492bd148aceaac 100644 (file)
@@ -33,7 +33,7 @@ import java.util.List;
  */
 public class DatabaseVersion implements BatchComponent, ServerComponent {
 
-  public static final int LAST_VERSION = 419;
+  public static final int LAST_VERSION = 430;
 
   public static enum Status {
     UP_TO_DATE, REQUIRES_UPGRADE, REQUIRES_DOWNGRADE, FRESH_INSTALL
index 98231f3ff1d50742690daf881e8974c177a644e7..29c4e6154452355aee49397c0864d44d3474500b 100644 (file)
@@ -172,6 +172,7 @@ INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('416');
 INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('417');
 INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('418');
 INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('419');
+INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('430');
 
 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;
index b450b85b8342693089c623da6beed905db58333d..ad2fdc11ed7bc2fe0ff8547681a231c8f24c53b7 100644 (file)
@@ -694,3 +694,5 @@ CREATE INDEX "SNAPSHOTS_ROOT_PROJECT_ID" ON "SNAPSHOTS" ("ROOT_PROJECT_ID");
 CREATE INDEX "GROUP_ROLES_ROLE" ON "GROUP_ROLES" ("ROLE");
 
 CREATE UNIQUE INDEX "RULES_PLUGIN_KEY_AND_NAME" ON "RULES" ("PLUGIN_RULE_KEY", "PLUGIN_NAME");
+
+CREATE INDEX "NOTIFICATIONS_CREATED_AT" ON "NOTIFICATIONS" ("CREATED_AT");
diff --git a/sonar-server/src/main/webapp/WEB-INF/db/migrate/430_add_index_to_notifications_created_at.rb b/sonar-server/src/main/webapp/WEB-INF/db/migrate/430_add_index_to_notifications_created_at.rb
new file mode 100644 (file)
index 0000000..d9d155f
--- /dev/null
@@ -0,0 +1,34 @@
+#
+# SonarQube, open source software quality management tool.
+# Copyright (C) 2008-2013 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.
+#
+
+#
+# @since SonarQube 4.0
+#
+class AddIndexToNotificationsCreatedAt < ActiveRecord::Migration
+
+  def self.up
+    begin
+      add_index :notifications, :created_at, :name => 'notifications_created_at'
+    rescue
+      # already exists
+    end
+  end
+
+end