]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-4979 fix compatibility with RoR dev mode
authorSimon Brandhof <simon.brandhof@sonarsource.com>
Tue, 23 Sep 2014 20:12:30 +0000 (22:12 +0200)
committerSimon Brandhof <simon.brandhof@sonarsource.com>
Tue, 23 Sep 2014 20:12:30 +0000 (22:12 +0200)
server/sonar-web/src/main/webapp/WEB-INF/db/migrate/526_remove_active_dashboards_linked_on_unshared_dashboards.rb [deleted file]
server/sonar-web/src/main/webapp/WEB-INF/db/migrate/526_remove_unshared_active_dashboards.rb [new file with mode: 0644]

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 (file)
index 7471059..0000000
+++ /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 (file)
index 0000000..6c35790
--- /dev/null
@@ -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