]> source.dussan.org Git - sonarqube.git/commitdiff
Better migrations
authorDavid Gageot <david@gageot.net>
Thu, 24 May 2012 16:02:50 +0000 (18:02 +0200)
committerDavid Gageot <david@gageot.net>
Thu, 24 May 2012 16:02:50 +0000 (18:02 +0200)
sonar-server/src/main/webapp/WEB-INF/db/migrate/300_add_global_to_dashboards.rb
sonar-server/src/main/webapp/WEB-INF/db/migrate/302_create_global_dashboards_for_filter.rb

index 7b90a52dde080455e10352b3cea44a2f6a5deb3f..a07b2deb5a84d83f398a66f8727c20271028e6e4 100644 (file)
 #
 class AddGlobalToDashboards < ActiveRecord::Migration
 
+  class Dashboard < ActiveRecord::Base
+  end
+
   def self.up
     add_column 'dashboards', 'is_global', :boolean
+
+    Dashboard.reset_column_information
     Dashboard.update_all(Dashboard.sanitize_sql_for_assignment({:is_global => false}))
   end
 
index 4fb90f9926ee56f7a60622522d9fae789a9a3abf..eb0cdbaa50d85f8f0110d706335e4f277da63e42 100644 (file)
@@ -42,7 +42,9 @@ class CreateGlobalDashboardsForFilter < ActiveRecord::Migration
 
   def self.up
     dashboard_per_filter = create_global_dahboards()
+
     activate_dashboards(dashboard_per_filter)
+
     drop_table('active_filters')
   end