summaryrefslogtreecommitdiffstats
path: root/sonar-server/src/main
diff options
context:
space:
mode:
authorJulien Lancelot <julien.lancelot@sonarsource.com>2014-07-01 16:26:06 +0200
committerJulien Lancelot <julien.lancelot@sonarsource.com>2014-07-01 16:33:45 +0200
commite7b58a71656a61b36449afdd76ba4eaacc44f950 (patch)
tree1ca4c7e7d19c3729a8cb8931bbd1beedfb8bc36f /sonar-server/src/main
parentbdc239fc9ac9c6aa94bc80eab122de7a0fb698ef (diff)
downloadsonarqube-e7b58a71656a61b36449afdd76ba4eaacc44f950.tar.gz
sonarqube-e7b58a71656a61b36449afdd76ba4eaacc44f950.zip
SONAR-5426 Rule name and description must always be not null
Diffstat (limited to 'sonar-server/src/main')
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/db/migrate/556_fill_rules_empty_name_and_desc.rb45
1 files changed, 45 insertions, 0 deletions
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