diff options
author | Julien Lancelot <julien.lancelot@sonarsource.com> | 2014-07-01 16:26:06 +0200 |
---|---|---|
committer | Julien Lancelot <julien.lancelot@sonarsource.com> | 2014-07-01 16:33:45 +0200 |
commit | e7b58a71656a61b36449afdd76ba4eaacc44f950 (patch) | |
tree | 1ca4c7e7d19c3729a8cb8931bbd1beedfb8bc36f | |
parent | bdc239fc9ac9c6aa94bc80eab122de7a0fb698ef (diff) | |
download | sonarqube-e7b58a71656a61b36449afdd76ba4eaacc44f950.tar.gz sonarqube-e7b58a71656a61b36449afdd76ba4eaacc44f950.zip |
SONAR-5426 Rule name and description must always be not null
3 files changed, 47 insertions, 1 deletions
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 c7ff86a5f0c..2eeaa8c21dd 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 = 555; + public static final int LAST_VERSION = 556; 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 e93794de62f..cfc4e72849d 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 @@ -248,6 +248,7 @@ INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('552'); INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('553'); INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('554'); INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('555'); +INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('556'); 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/556_fill_rules_empty_name_and_desc.rb b/sonar-server/src/main/webapp/WEB-INF/db/migrate/556_fill_rules_empty_name_and_desc.rb new file mode 100644 index 00000000000..28b6f96f852 --- /dev/null +++ b/sonar-server/src/main/webapp/WEB-INF/db/migrate/556_fill_rules_empty_name_and_desc.rb @@ -0,0 +1,45 @@ +# +# 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.4 +# SONAR-5426 +# +class FillRulesEmptyNameAndDesc < ActiveRecord::Migration + + class Rule < ActiveRecord::Base + end + + def self.up + Rule.reset_column_information + + Rule.all(['name IS NULL OR description IS NULL']).each do |rule| + key = rule.plugin_rule_key + unless rule.name + rule.name = key + end + unless rule.description + rule.description = key + end + rule.save! + end + end + +end |