From ea3410381c61693d4e87c3aef15d884767360d56 Mon Sep 17 00:00:00 2001 From: David Gageot Date: Thu, 24 May 2012 18:02:50 +0200 Subject: [PATCH] Better migrations --- .../WEB-INF/db/migrate/300_add_global_to_dashboards.rb | 5 +++++ .../db/migrate/302_create_global_dashboards_for_filter.rb | 2 ++ 2 files changed, 7 insertions(+) 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 -- 2.39.5