From: David Gageot Date: Thu, 24 May 2012 16:02:50 +0000 (+0200) Subject: Better migrations X-Git-Tag: 3.1~72 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=ea3410381c61693d4e87c3aef15d884767360d56;p=sonarqube.git Better migrations --- diff --git a/sonar-server/src/main/webapp/WEB-INF/db/migrate/300_add_global_to_dashboards.rb b/sonar-server/src/main/webapp/WEB-INF/db/migrate/300_add_global_to_dashboards.rb index 7b90a52dde0..a07b2deb5a8 100644 --- a/sonar-server/src/main/webapp/WEB-INF/db/migrate/300_add_global_to_dashboards.rb +++ b/sonar-server/src/main/webapp/WEB-INF/db/migrate/300_add_global_to_dashboards.rb @@ -23,8 +23,13 @@ # 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 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 4fb90f9926e..eb0cdbaa50d 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 @@ -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