diff options
author | simonbrandhof <simon.brandhof@gmail.com> | 2010-09-16 15:58:42 +0000 |
---|---|---|
committer | simonbrandhof <simon.brandhof@gmail.com> | 2010-09-16 15:58:42 +0000 |
commit | 690808781ae7625dad12536fe19a15a0146bdbae (patch) | |
tree | 6401137c24cb7825420613bf87d273c49f176244 /sonar-server | |
parent | 17976169eb50d6c8d715285ee40bcb3b9ca12bed (diff) | |
download | sonarqube-690808781ae7625dad12536fe19a15a0146bdbae.tar.gz sonarqube-690808781ae7625dad12536fe19a15a0146bdbae.zip |
add the column CHARACTERISTICS.ENABLED
Diffstat (limited to 'sonar-server')
3 files changed, 31 insertions, 1 deletions
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/models/characteristic.rb b/sonar-server/src/main/webapp/WEB-INF/app/models/characteristic.rb index 2603b99ac29..ad372e6ae5d 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/models/characteristic.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/models/characteristic.rb @@ -28,6 +28,10 @@ class Characteristic < ActiveRecord::Base belongs_to :rule belongs_to :quality_model + + validates_uniqueness_of :name, :scope => :quality_model_id, :case_sensitive => false, :if => Proc.new { |c| c.rule_id.nil? } + validates_length_of :name, :in => 1..100, :allow_blank => false, :if => Proc.new { |c| c.rule_id.nil? } + validates_presence_of :quality_model def root? depth==1 diff --git a/sonar-server/src/main/webapp/WEB-INF/db/migrate/138_add_characteristic_description.rb b/sonar-server/src/main/webapp/WEB-INF/db/migrate/138_add_characteristic_description.rb index 88f1f5147af..cef6e279898 100644 --- a/sonar-server/src/main/webapp/WEB-INF/db/migrate/138_add_characteristic_description.rb +++ b/sonar-server/src/main/webapp/WEB-INF/db/migrate/138_add_characteristic_description.rb @@ -21,7 +21,6 @@ class AddCharacteristicDescription < ActiveRecord::Migration def self.up add_column 'characteristics', 'description', :string, :null => true, :limit => 4000 - Characteristic.reset_column_information end end diff --git a/sonar-server/src/main/webapp/WEB-INF/db/migrate/139_add_characteristic_enabled.rb b/sonar-server/src/main/webapp/WEB-INF/db/migrate/139_add_characteristic_enabled.rb new file mode 100644 index 00000000000..ec149acfb09 --- /dev/null +++ b/sonar-server/src/main/webapp/WEB-INF/db/migrate/139_add_characteristic_enabled.rb @@ -0,0 +1,27 @@ +# +# Sonar, entreprise quality control tool. +# Copyright (C) 2009 SonarSource SA +# 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 +# +class AddCharacteristicEnabled < ActiveRecord::Migration + + def self.up + add_column 'characteristics', 'enabled', :boolean, :null => true + Characteristic.reset_column_information + end + +end |