diff options
Diffstat (limited to 'server/sonar-web/src')
21 files changed, 0 insertions, 559 deletions
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/001_initial_schema.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/001_initial_schema.rb index d2f125cfff6..9c9346866b3 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/001_initial_schema.rb +++ b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/001_initial_schema.rb @@ -85,11 +85,6 @@ class InitialSchema < ActiveRecord::Migration t.column :diff_value_3, :decimal, :null => true, :precision => 30, :scale => 20 end - create_table :rules_categories do |t| - t.column :name, :string, :null => false, :limit => 255 - t.column :description, :string, :null => false, :limit => 1000 - end - create_table :rules do |t| t.column :name, :string, :null => false, :limit => 192 t.column :plugin_rule_key, :string, :null => false, :limit => 200 diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/221_attach_events_to_snapshots.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/221_attach_events_to_snapshots.rb deleted file mode 100644 index 80d86c79361..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/221_attach_events_to_snapshots.rb +++ /dev/null @@ -1,62 +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. -# - -# -# Sonar 2.12 -# -class AttachEventsToSnapshots < ActiveRecord::Migration - - class Event < ActiveRecord::Base - end - - class Snapshot < ActiveRecord::Base - end - - def self.up - logger = RAILS_DEFAULT_LOGGER - Event.reset_column_information - Snapshot.reset_column_information - - Event.find(:all, :conditions => "snapshot_id IS NULL").each do |event| - begin - next_snapshot = Snapshot.find(:first, :conditions => ["created_at >= ? AND project_id = ?", event.event_date, event.resource_id], :order => :created_at) - if next_snapshot && (event.category!='Version' || !has_category?(next_snapshot, 'Version')) - event.snapshot_id = next_snapshot.id - event.event_date = next_snapshot.created_at - event.save - else - previous_snapshot = Snapshot.find(:last, :conditions => ["created_at <= ? AND project_id = ?", event.event_date, event.resource_id], :order => :created_at) - if previous_snapshot && (event.category!='Version' || !has_category?(previous_snapshot,'Version')) - event.snapshot_id = previous_snapshot.id - event.event_date = previous_snapshot.created_at - event.save - end - end - rescue Exception => e - # do nothing and leave this event as is. - logger.warn("The following event could not be attached to a snapshot, and therefore won't be used in the future: " + event.name) - end - end - end - - def self.has_category?(snapshot, category) - Event.exists?({:category => category, :snapshot_id => snapshot.id}) - end -end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/235_create_loaded_templates.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/235_create_loaded_templates.rb index 981a2c6a975..881f6ecf760 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/235_create_loaded_templates.rb +++ b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/235_create_loaded_templates.rb @@ -23,24 +23,11 @@ # class CreateLoadedTemplates < ActiveRecord::Migration - class Dashboard < ActiveRecord::Base - end - - class LoadedTemplate < ActiveRecord::Base - end - def self.up create_table 'loaded_templates' do |t| t.column 'kee', :string, :null => true, :limit => 200 t.column 'template_type', :string, :null => true, :limit => 15 end - - # if this is a migration, then the default dashboard already exists in the DB so it should not be loaded again - Dashboard.reset_column_information - if Dashboard.exists?(:name => 'Dashboard', :user_id => nil) - LoadedTemplate.reset_column_information - LoadedTemplate.create({:template_type => 'DASHBOARD', :kee => 'Dashboard'}) - end end end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/240_delete_resource_orphans.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/240_delete_resource_orphans.rb deleted file mode 100644 index dd071aae41d..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/240_delete_resource_orphans.rb +++ /dev/null @@ -1,45 +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. -# - -# -# Delete the resource orphans that are automatically deleted as long as -# SONAR-3120 is not fixed. -# -# Sonar 2.13 -# -class DeleteResourceOrphans < ActiveRecord::Migration - - class Project < ActiveRecord::Base - end - - def self.up - Project.reset_column_information - ids=Project.find_by_sql(["select id from projects p where qualifier<>'LIB' and not exists (select * from snapshots s where s.project_id = p.id and s.islast=?)", true]) - say_with_time "Delete #{ids.size} resources" do - # partition ids because of the Oracle limitation on IN statements - ids.each_slice(999) do |partition_of_ids| - unless partition_of_ids.empty? - Project.delete_all(["id in (?)", partition_of_ids]) - end - end - end - end - -end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/255_rename_dbcleaner_properties.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/255_rename_dbcleaner_properties.rb deleted file mode 100644 index c1350dcfb5a..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/255_rename_dbcleaner_properties.rb +++ /dev/null @@ -1,43 +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. -# - -# -# Sonar 2.14 -# -class RenameDbcleanerProperties < ActiveRecord::Migration - - class Property < ActiveRecord::Base - end - - - def self.up - Property.reset_column_information - rename('sonar.dbcleaner.monthsBeforeKeepingOnlyOneSnapshotByWeek', 'sonar.dbcleaner.weeksBeforeKeepingOnlyOneSnapshotByWeek') - rename('sonar.dbcleaner.monthsBeforeKeepingOnlyOneSnapshotByMonth', 'sonar.dbcleaner.weeksBeforeKeepingOnlyOneSnapshotByMonth') - rename('sonar.dbcleaner.monthsBeforeDeletingAllSnapshots', 'sonar.dbcleaner.weeksBeforeDeletingAllSnapshots') - end - - private - def self.rename(month_key, week_key) - Property.find(:all, :conditions => ['prop_key=? and text_value is not null', month_key]).each do |month_property| - Property.create(:prop_key => week_key, :resource_id => month_property.resource_id, :text_value => (month_property.text_value.to_i * 4).to_s) - end - end -end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/262_create_authors.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/262_create_authors.rb deleted file mode 100644 index ed5980e9729..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/262_create_authors.rb +++ /dev/null @@ -1,30 +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. -# - -# -# Sonar 2.14 -# -class CreateAuthors < ActiveRecord::Migration - - def self.up - # removed in version 3.0, see migration 283 - end - -end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/280_drop_table_rules_categories.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/280_drop_table_rules_categories.rb deleted file mode 100644 index 2bb8dc99928..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/280_drop_table_rules_categories.rb +++ /dev/null @@ -1,30 +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. -# - -# -# Sonar 3.0 -# -class DropTableRulesCategories < ActiveRecord::Migration - - def self.up - drop_table('rules_categories') - end - -end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/283_add_authors_primary_key.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/283_add_authors_primary_key.rb index 34958ebac90..e1368d62d3b 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/283_add_authors_primary_key.rb +++ b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/283_add_authors_primary_key.rb @@ -24,12 +24,6 @@ class AddAuthorsPrimaryKey < ActiveRecord::Migration def self.up - begin - drop_table 'authors' - rescue - # table does not exist -> this is not an upgrade but a fresh install - end - create_table 'authors' do |t| t.column 'person_id', :integer, :null => false t.column 'login', :string, :null => true, :limit => 100 diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/284_add_default_description_to_manual_rules.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/284_add_default_description_to_manual_rules.rb deleted file mode 100644 index 8eabee99a8d..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/284_add_default_description_to_manual_rules.rb +++ /dev/null @@ -1,35 +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. -# - -# -# Sonar 3.0 -# -class AddDefaultDescriptionToManualRules < ActiveRecord::Migration - - class Rule < ActiveRecord::Base - end - - def self.up - Rule.reset_column_information - Rule.update_all(Rule.sanitize_sql_for_assignment({:description => 'Rule created on the fly. A description should be provided.'}), - "description IS null AND plugin_name = 'manual'") - end - -end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/287_index_projects.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/287_index_projects.rb deleted file mode 100644 index 246afb00dfb..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/287_index_projects.rb +++ /dev/null @@ -1,54 +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. -# - -# -# Sonar 3.0 -# -class IndexProjects < ActiveRecord::Migration - - class ResourceIndex < ActiveRecord::Base - set_table_name 'resource_index' - end - - class Project < ActiveRecord::Base - end - - def self.up - ResourceIndex.reset_column_information - Project.reset_column_information - - projects = Project.find(:all, :select => 'id', :conditions => {:enabled => true, :scope => 'PRJ'}) - - if projects.size>0 - if dialect()=='oracle' - # SONAR-4608 - # Fix upgrade from 2.x to 3.7 - create_id_trigger('resource_index') - end - - say_with_time "Index #{projects.size} projects" do - projects.each do |project| - Java::OrgSonarServerUi::JRubyFacade.getInstance().indexResource(project.id) - end - end - end - end - -end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/300_add_global_to_dashboards.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/300_add_global_to_dashboards.rb index ec883279d95..13211b815a0 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/300_add_global_to_dashboards.rb +++ b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/300_add_global_to_dashboards.rb @@ -23,14 +23,8 @@ # 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 end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/332_remove_profiles_enabled_column.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/332_remove_profiles_enabled_column.rb index f11b888347d..b528d24b799 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/332_remove_profiles_enabled_column.rb +++ b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/332_remove_profiles_enabled_column.rb @@ -23,20 +23,7 @@ # class RemoveProfilesEnabledColumn < ActiveRecord::Migration - class Profile < ActiveRecord::Base - set_table_name 'rules_profiles' - end - - class ActiveRule < ActiveRecord::Base - end - def self.up - disabled_profiles = Profile.find(:all, :conditions => {:enabled => false}) - disabled_profiles.each do |profile| - ActiveRule.delete_all ['profile_id=?', profile.id] - Profile.delete(profile.id) - end - remove_column('rules_profiles', 'enabled') end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/334_remove_profiles_default_column.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/334_remove_profiles_default_column.rb index 42554bb7e69..4847a8eca2c 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/334_remove_profiles_default_column.rb +++ b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/334_remove_profiles_default_column.rb @@ -23,18 +23,7 @@ # class RemoveProfilesDefaultColumn < ActiveRecord::Migration - class Profile < ActiveRecord::Base - set_table_name 'rules_profiles' - end - - class Property < ActiveRecord::Base - end - def self.up - Profile.find(:all, :conditions => ['default_profile=?', true]).each do |profile| - Property.create :prop_key => "sonar.profile.#{profile.language}", :text_value => profile.name - end - remove_column('rules_profiles', 'default_profile') end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/351_add_unique_index_to_authors.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/351_add_unique_index_to_authors.rb index 9e98bb2fbde..712fa2fd5a0 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/351_add_unique_index_to_authors.rb +++ b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/351_add_unique_index_to_authors.rb @@ -23,27 +23,8 @@ # class AddUniqueIndexToAuthors < ActiveRecord::Migration - class Author < ActiveRecord::Base - end - def self.up - delete_duplicated_authors add_index :authors, :login, :unique => true, :name => 'uniq_author_logins' end - private - def self.delete_duplicated_authors - say_with_time 'Delete duplicated authors' do - authors_by_login={} - authors=Author.find(:all, :select => 'id,login', :order => 'id') - authors.each do |author| - if authors_by_login[author.login] - # already exists - author.destroy - else - authors_by_login[author.login]=author - end - end - end - end end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/352_rename_java_coverage_property.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/352_rename_java_coverage_property.rb deleted file mode 100644 index 56256c34327..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/352_rename_java_coverage_property.rb +++ /dev/null @@ -1,32 +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. -# - -# -# Sonar 3.4 -# -class RenameJavaCoverageProperty < ActiveRecord::Migration - - class Property < ActiveRecord::Base - end - - def self.up - Property.update_all({:prop_key=> 'sonar.java.coveragePlugin'}, ['prop_key=?', 'sonar.core.codeCoveragePlugin']) - end -end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/363_ignore_home_dashboard_on_upgrades.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/363_ignore_home_dashboard_on_upgrades.rb deleted file mode 100644 index c5869cf9a1f..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/363_ignore_home_dashboard_on_upgrades.rb +++ /dev/null @@ -1,35 +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. -# - -# -# Sonar 3.4 -# -class IgnoreHomeDashboardOnUpgrades < ActiveRecord::Migration - - class LoadedTemplate < ActiveRecord::Base - end - - def self.up - if LoadedTemplate.count(:all)>0 && !LoadedTemplate.exists?({:template_type => 'DASHBOARD', :kee => 'Home'}) - LoadedTemplate.create({:template_type => 'DASHBOARD', :kee => 'Home'}) - end - end - -end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/381_update_rules_status.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/381_update_rules_status.rb deleted file mode 100644 index 4351860f9a4..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/381_update_rules_status.rb +++ /dev/null @@ -1,36 +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. -# - -# -# Sonar 3.6 -# -class UpdateRulesStatus < ActiveRecord::Migration - - class Rule < ActiveRecord::Base - end - - def self.up - Rule.reset_column_information - Rule.update_all({:status => 'READY', :created_at => Time.now}, ['enabled=?', true]) - Rule.update_all({:status => 'REMOVED', :created_at => Time.now, :updated_at => Time.now}, ['enabled=?', false]) - end - -end - diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/383_update_metrics_user_managed_created_by_ws.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/383_update_metrics_user_managed_created_by_ws.rb deleted file mode 100644 index 0989a95ca2e..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/383_update_metrics_user_managed_created_by_ws.rb +++ /dev/null @@ -1,35 +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. -# - -# -# Sonar 3.6 -# -class UpdateMetricsUserManagedCreatedByWs < ActiveRecord::Migration - - class Metric < ActiveRecord::Base - end - - def self.up - Metric.reset_column_information - Metric.update_all({:user_managed => true}, ['user_managed=? and origin=?', false, 'WS']) - end - -end - diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/392_update_active_rule_changes_user_name_to_nullable.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/392_update_active_rule_changes_user_name_to_nullable.rb index deb4359da7a..ece40e4507f 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/392_update_active_rule_changes_user_name_to_nullable.rb +++ b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/392_update_active_rule_changes_user_name_to_nullable.rb @@ -30,10 +30,6 @@ class UpdateActiveRuleChangesUserNameToNullable < ActiveRecord::Migration # Due to an issue on Oracle, it's not possible to use change_column to set a column to nullable, we had to create another column add_column 'active_rule_changes', 'username', :string, :limit => 200, :null => true - ActiveRuleChange.reset_column_information - ActiveRuleChange.all.each do |a| - a.update_attributes!(:username => a.user_name) - end remove_column 'active_rule_changes', 'user_name' end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/394_add_key_to_action_plan.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/394_add_key_to_action_plan.rb index 1da713a5c12..edcf5bf1591 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/394_add_key_to_action_plan.rb +++ b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/394_add_key_to_action_plan.rb @@ -23,15 +23,8 @@ # class AddKeyToActionPlan < ActiveRecord::Migration - class ActionPlan < ActiveRecord::Base - end - def self.up add_column 'action_plans', 'kee', :string, :null => true, :limit => 100 - ActionPlan.reset_column_information - ActionPlan.all.each do |a| - a.update_attributes!(:kee => Java::OrgSonarApiUtilsInternal::Uuids.create()) - end end end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/406_update_issues_action_plan_key.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/406_update_issues_action_plan_key.rb deleted file mode 100644 index 1f082e78ef6..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/406_update_issues_action_plan_key.rb +++ /dev/null @@ -1,38 +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. -# - -# -# Sonar 3.6.1 -# -# SONAR-4449 -# -class UpdateIssuesActionPlanKey < ActiveRecord::Migration - - class Issue < ActiveRecord::Base - end - - # Update issues that are still linked to removed action plans - def self.up - Issue.reset_column_information - Issue.update_all({:action_plan_key => nil}, "action_plan_key is not null AND not exists (select * from action_plans ap where ap.kee = action_plan_key)") - end - -end - |