]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-2673 Fail to upgrade from 2.8 to 2.9 because of migration of reviews
authorSimon Brandhof <simon.brandhof@gmail.com>
Mon, 8 Aug 2011 08:38:46 +0000 (10:38 +0200)
committerSimon Brandhof <simon.brandhof@gmail.com>
Mon, 8 Aug 2011 08:38:46 +0000 (10:38 +0200)
sonar-server/src/main/webapp/WEB-INF/db/migrate/201_change_false_positive_on_reviews.rb

index fa0d157e867b656c6d89dc1844682a693d7a0a9c..dfaeed23ffa95bcac474ee337c56c41411a79801 100644 (file)
@@ -27,14 +27,8 @@ class ChangeFalsePositiveOnReviews < ActiveRecord::Migration
     add_column 'reviews', 'resolution', :string, :limit => 200, :null => true
     Review.reset_column_information
 
-    Review.find(:all).each do |review|
-      if review.review_type == 'FALSE_POSITIVE'
-        review.status = 'RESOLVED'
-        review.resolution = 'FALSE-POSITIVE'
-      end
-      review.save!
-    end
-
+    Review.update_all("status='RESOLVED', resolution='FALSE-POSITIVE'", "review_type='FALSE_POSITIVE'")
+    
     remove_column 'reviews', 'review_type'
     Review.reset_column_information
   end