From: Simon Brandhof Date: Tue, 23 Sep 2014 20:12:30 +0000 (+0200) Subject: SONAR-4979 fix compatibility with RoR dev mode X-Git-Tag: 5.0-RC1~942 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=5b7386b8b677e37f225b91807459fffff096bc7c;p=sonarqube.git SONAR-4979 fix compatibility with RoR dev mode --- 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_active_dashboards_linked_on_unshared_dashboards.rb deleted file mode 100644 index 74710591d2e..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/526_remove_active_dashboards_linked_on_unshared_dashboards.rb +++ /dev/null @@ -1,42 +0,0 @@ -# -# SonarQube, open source software quality management tool. -# Copyright (C) 2008-2014 SonarSource -# mailto:contact AT sonarsource DOT com -# -# SonarQube 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. -# -# SonarQube 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 this program; if not, write to the Free Software Foundation, -# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -# - -# -# SonarQube 4.3 -# SONAR-4979 -# -class RemoveActiveDashboardsLinkedOnUnsharedDashboards < ActiveRecord::Migration - - class Dashboard < ActiveRecord::Base - end - - class ActiveDashboard < ActiveRecord::Base - belongs_to :dashboard - end - - def self.up - Dashboard.reset_column_information - 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} - end - -end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/526_remove_unshared_active_dashboards.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/526_remove_unshared_active_dashboards.rb new file mode 100644 index 00000000000..6c35790ce4e --- /dev/null +++ b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/526_remove_unshared_active_dashboards.rb @@ -0,0 +1,44 @@ +# +# SonarQube, open source software quality management tool. +# Copyright (C) 2008-2014 SonarSource +# mailto:contact AT sonarsource DOT com +# +# SonarQube 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. +# +# SonarQube 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 this program; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# + +# +# SonarQube 4.3 +# SONAR-4979 +# +class RemoveUnsharedActiveDashboards < ActiveRecord::Migration + + class Dashboard < ActiveRecord::Base + set_table_name 'dashboards' + end + + class ActiveDashboard < ActiveRecord::Base + set_table_name 'active_dashboards' + belongs_to :dashboard, :class_name => 'Dashboard' + end + + def self.up + Dashboard.reset_column_information + ActiveDashboard.reset_column_information + + # Delete every active_dashboards linked on unshared dashboard not owned by the user + 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