aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-server
diff options
context:
space:
mode:
authorDavid Gageot <david@gageot.net>2012-06-29 16:53:50 +0200
committerDavid Gageot <david@gageot.net>2012-06-29 16:53:50 +0200
commit8a43d9562675bc71fe07d810faa890a853ca2552 (patch)
treecf065453260766153caae066fa7061b2ee6af4e3 /sonar-server
parent87585967c3eef34999607a6aa3c9fb157e9ff535 (diff)
downloadsonarqube-8a43d9562675bc71fe07d810faa890a853ca2552.tar.gz
sonarqube-8a43d9562675bc71fe07d810faa890a853ca2552.zip
SONAR-3594 Ignore unknown filters during migration to 3.1
Because we activate a Global Dashboard for each Active Filter, we need to ignore those pointing to a deleted Filter.
Diffstat (limited to 'sonar-server')
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/db/migrate/302_create_global_dashboards_for_filter.rb17
1 files changed, 9 insertions, 8 deletions
diff --git a/sonar-server/src/main/webapp/WEB-INF/db/migrate/302_create_global_dashboards_for_filter.rb b/sonar-server/src/main/webapp/WEB-INF/db/migrate/302_create_global_dashboards_for_filter.rb
index eb0cdbaa50d..a7ddebd1602 100644
--- a/sonar-server/src/main/webapp/WEB-INF/db/migrate/302_create_global_dashboards_for_filter.rb
+++ b/sonar-server/src/main/webapp/WEB-INF/db/migrate/302_create_global_dashboards_for_filter.rb
@@ -78,14 +78,15 @@ class CreateGlobalDashboardsForFilter < ActiveRecord::Migration
def self.activate_dashboards(dashboard_per_filter)
ActiveFilter.find(:all).each do |activeFilter|
- filter = Filter.find(activeFilter.filter_id)
-
- dashboard = dashboard_per_filter[filter.id]
-
- if !filter.favourites || activeFilter.user_id
- ActiveDashboard.create(:dashboard_id => dashboard.id,
- :user_id => activeFilter.user_id,
- :order_index => activeFilter.order_index)
+ filter = Filter.find_by_id(activeFilter.filter_id)
+ if filter
+ dashboard = dashboard_per_filter[filter.id]
+
+ if !filter.favourites || activeFilter.user_id
+ ActiveDashboard.create(:dashboard_id => dashboard.id,
+ :user_id => activeFilter.user_id,
+ :order_index => activeFilter.order_index)
+ end
end
end
end