diff options
author | Simon Brandhof <simon.brandhof@gmail.com> | 2012-01-26 18:14:17 +0100 |
---|---|---|
committer | Simon Brandhof <simon.brandhof@gmail.com> | 2012-01-26 18:14:17 +0100 |
commit | 9ef0ec8571badea96052ffdddbcad5c09137e5fe (patch) | |
tree | 9536215a7073fec34eb6629aa8df906799ca60b9 /sonar-server | |
parent | 1be37880a5ecfb86bd9fb326d42bbb5c5bfeaac6 (diff) | |
download | sonarqube-9ef0ec8571badea96052ffdddbcad5c09137e5fe.tar.gz sonarqube-9ef0ec8571badea96052ffdddbcad5c09137e5fe.zip |
SONAR-1960 DBCleaner properties should be expressed in weeks instead of months
Diffstat (limited to 'sonar-server')
-rw-r--r-- | sonar-server/src/main/webapp/WEB-INF/db/migrate/255_rename_dbcleaner_properties.rb | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/sonar-server/src/main/webapp/WEB-INF/db/migrate/255_rename_dbcleaner_properties.rb b/sonar-server/src/main/webapp/WEB-INF/db/migrate/255_rename_dbcleaner_properties.rb new file mode 100644 index 00000000000..c1b60665f4a --- /dev/null +++ b/sonar-server/src/main/webapp/WEB-INF/db/migrate/255_rename_dbcleaner_properties.rb @@ -0,0 +1,42 @@ +# +# 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.14 +# +class RenameDbcleanerProperties < ActiveRecord::Migration + + class Property < ActiveRecord::Base + end + + + def self.up + rename('sonar.dbcleaner.monthsBeforeKeepingOnlyOneSnapshotByWeek', 'sonar.dbcleaner.weeksBeforeKeepingOnlyOneSnapshotByWeek') + rename('sonar.dbcleaner.monthsBeforeKeepingOnlyOneSnapshotByMonth', 'sonar.dbcleaner.weeksBeforeKeepingOnlyOneSnapshotByMonth') + rename('sonar.dbcleaner.monthsBeforeDeletingAllSnapshots', 'sonar.dbcleaner.weeksBeforeDeletingAllSnapshots') + end + + private + def self.rename(month_key, week_key) + Property.find(:all, :conditions => ['prop_key=? and text_value is not null', month_key]).each do |month_property| + Property.create(:prop_key => week_key, :resource_id => month_property.resource_id, :text_value => (month_property.text_value.to_i * 4).to_s) + end + end +end |