From 5b7386b8b677e37f225b91807459fffff096bc7c Mon Sep 17 00:00:00 2001 From: Simon Brandhof Date: Tue, 23 Sep 2014 22:12:30 +0200 Subject: [PATCH] SONAR-4979 fix compatibility with RoR dev mode --- ...boards.rb => 526_remove_unshared_active_dashboards.rb} | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) rename server/sonar-web/src/main/webapp/WEB-INF/db/migrate/{526_remove_active_dashboards_linked_on_unshared_dashboards.rb => 526_remove_unshared_active_dashboards.rb} (74%) diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/526_remove_active_dashboards_linked_on_unshared_dashboards.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/526_remove_unshared_active_dashboards.rb similarity index 74% rename from server/sonar-web/src/main/webapp/WEB-INF/db/migrate/526_remove_active_dashboards_linked_on_unshared_dashboards.rb rename to server/sonar-web/src/main/webapp/WEB-INF/db/migrate/526_remove_unshared_active_dashboards.rb index 74710591d2e..6c35790ce4e 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/526_remove_active_dashboards_linked_on_unshared_dashboards.rb +++ b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/526_remove_unshared_active_dashboards.rb @@ -22,13 +22,15 @@ # SonarQube 4.3 # SONAR-4979 # -class RemoveActiveDashboardsLinkedOnUnsharedDashboards < ActiveRecord::Migration +class RemoveUnsharedActiveDashboards < ActiveRecord::Migration class Dashboard < ActiveRecord::Base + set_table_name 'dashboards' end class ActiveDashboard < ActiveRecord::Base - belongs_to :dashboard + set_table_name 'active_dashboards' + belongs_to :dashboard, :class_name => 'Dashboard' end def self.up @@ -36,7 +38,7 @@ class RemoveActiveDashboardsLinkedOnUnsharedDashboards < ActiveRecord::Migration ActiveDashboard.reset_column_information # Delete every active_dashboards linked on unshared dashboard not owned by the user - ActiveDashboard.all(:include => :dashboard, :conditions => ['dashboards.shared=? AND active_dashboards.user_id<>dashboards.user_id', false]).each {|ad| ad.delete} + ActiveDashboard.all(:joins => 'inner join dashboards on dashboards.id=active_dashboards.dashboard_id', :conditions => ['dashboards.shared=? AND active_dashboards.user_id<>dashboards.user_id', false]).each {|ad| ad.delete} end end -- 2.39.5