aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-server
diff options
context:
space:
mode:
Diffstat (limited to 'sonar-server')
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/models/dashboard.rb1
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/db/migrate/300_add_global_to_dashboards.rb3
2 files changed, 3 insertions, 1 deletions
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/models/dashboard.rb b/sonar-server/src/main/webapp/WEB-INF/app/models/dashboard.rb
index 1dfdc522b57..3562e5232ef 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/models/dashboard.rb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/models/dashboard.rb
@@ -30,6 +30,7 @@ class Dashboard < ActiveRecord::Base
validates_length_of :description, :maximum => 1000, :allow_blank => true, :allow_nil => true
validates_length_of :column_layout, :maximum => 20, :allow_blank => false, :allow_nil => false
validates_uniqueness_of :name, :scope => :user_id
+ validates_inclusion_of :is_global, :in => [true, false]
before_destroy :check_not_default_before_destroy
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 1b87e6c7026..7b90a52dde0 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
@@ -24,7 +24,8 @@
class AddGlobalToDashboards < ActiveRecord::Migration
def self.up
- add_column 'dashboards', 'is_global', :boolean, :null => false
+ add_column 'dashboards', 'is_global', :boolean
+ Dashboard.update_all(Dashboard.sanitize_sql_for_assignment({:is_global => false}))
end
end