From: Fabrice Bellingard Date: Thu, 29 Mar 2012 07:20:37 +0000 (+0200) Subject: SONAR-3359 Set default description for existing manual rules X-Git-Tag: 3.0~97 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=c4b8105e1fa9f4355113f0aaa00a9af435eb2898;p=sonarqube.git SONAR-3359 Set default description for existing manual rules => Only for existing manual rules created on the fly. --- 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 00c9958beff..07514542abf 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 @@ -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 diff --git a/sonar-core/src/main/resources/org/sonar/core/persistence/rows-derby.sql b/sonar-core/src/main/resources/org/sonar/core/persistence/rows-derby.sql index 0ba5e36a0ac..e2e494d4b8c 100644 --- a/sonar-core/src/main/resources/org/sonar/core/persistence/rows-derby.sql +++ b/sonar-core/src/main/resources/org/sonar/core/persistence/rows-derby.sql @@ -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 index 00000000000..9d2e7230198 --- /dev/null +++ b/sonar-server/src/main/webapp/WEB-INF/db/migrate/284_add_default_description_to_manual_rules.rb @@ -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