]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-3359 Set default description for existing manual rules
authorFabrice Bellingard <bellingard@gmail.com>
Thu, 29 Mar 2012 07:20:37 +0000 (09:20 +0200)
committerFabrice Bellingard <bellingard@gmail.com>
Thu, 29 Mar 2012 07:56:24 +0000 (09:56 +0200)
=> Only for existing manual rules created on the fly.

sonar-core/src/main/java/org/sonar/core/persistence/DatabaseVersion.java
sonar-core/src/main/resources/org/sonar/core/persistence/rows-derby.sql
sonar-server/src/main/webapp/WEB-INF/db/migrate/284_add_default_description_to_manual_rules.rb [new file with mode: 0644]

index 00c9958beffe8439baeac86339ac309a3bc89acd..07514542abf79a8ee201e64f48c349a12412184e 100644 (file)
@@ -32,7 +32,7 @@ import java.util.List;
  */
 public class DatabaseVersion implements BatchComponent, ServerComponent {
 
-  public static final int LAST_VERSION = 283;
+  public static final int LAST_VERSION = 284;
 
   public static enum Status {
     UP_TO_DATE, REQUIRES_UPGRADE, REQUIRES_DOWNGRADE, FRESH_INSTALL
index 0ba5e36a0ac8109fedb11ec23a99e43666cb8290..e2e494d4b8c00a520adcf028807d3f9089eeefcd 100644 (file)
@@ -183,6 +183,7 @@ INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('280');
 INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('281');
 INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('282');
 INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('283');
+INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('284');
 
 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-server/src/main/webapp/WEB-INF/db/migrate/284_add_default_description_to_manual_rules.rb b/sonar-server/src/main/webapp/WEB-INF/db/migrate/284_add_default_description_to_manual_rules.rb
new file mode 100644 (file)
index 0000000..9d2e723
--- /dev/null
@@ -0,0 +1,35 @@
+#
+# Sonar, entreprise quality control tool.
+# Copyright (C) 2008-2012 SonarSource
+# mailto:contact AT sonarsource DOT com
+#
+# Sonar 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.
+#
+# Sonar 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 Sonar; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02
+#
+
+#
+# Sonar 2.15
+#
+class AddDefaultDescriptionToManualRules < ActiveRecord::Migration
+  
+  class Rule < ActiveRecord::Base
+  end
+  
+  def self.up
+    Rule.reset_column_information
+    Rule.update_all(Rule.sanitize_sql_for_assignment({:description => 'Rule created on the fly. A description should be provided.'}), 
+                    "description IS null AND plugin_name = 'manual'")
+  end
+
+end