From 44b9092bed4ebdd6cf213da6a6b01c1d0ff030a5 Mon Sep 17 00:00:00 2001 From: Simon Brandhof Date: Mon, 3 Dec 2012 18:34:30 +0100 Subject: [PATCH] Remove upgrades from version <= 2.2 --- .../WEB-INF/db/migrate/002_index_database.rb | 2 - .../db/migrate/053_create_events_table.rb | 1 + .../db/migrate/059_create_properties.rb | 1 + .../migrate/089_set_default_project_roles.rb | 26 ----- .../101_remove_null_snapshot_created_at.rb | 33 ------ .../WEB-INF/db/migrate/110_add_events_data.rb | 30 ----- .../112_delete_checkstyle_jee_rules.rb | 66 ----------- .../migrate/113_rename_clover_properties.rb | 38 ------- .../db/migrate/114_add_user_properties.rb | 29 ----- .../WEB-INF/db/migrate/115_create_filters.rb | 105 +----------------- .../db/migrate/116_set_resource_long_names.rb | 48 -------- .../migrate/117_remove_measure_sid_index.rb | 30 ----- 12 files changed, 3 insertions(+), 406 deletions(-) delete mode 100644 sonar-server/src/main/webapp/WEB-INF/db/migrate/089_set_default_project_roles.rb delete mode 100644 sonar-server/src/main/webapp/WEB-INF/db/migrate/101_remove_null_snapshot_created_at.rb delete mode 100644 sonar-server/src/main/webapp/WEB-INF/db/migrate/110_add_events_data.rb delete mode 100644 sonar-server/src/main/webapp/WEB-INF/db/migrate/112_delete_checkstyle_jee_rules.rb delete mode 100644 sonar-server/src/main/webapp/WEB-INF/db/migrate/113_rename_clover_properties.rb delete mode 100644 sonar-server/src/main/webapp/WEB-INF/db/migrate/114_add_user_properties.rb delete mode 100644 sonar-server/src/main/webapp/WEB-INF/db/migrate/116_set_resource_long_names.rb delete mode 100644 sonar-server/src/main/webapp/WEB-INF/db/migrate/117_remove_measure_sid_index.rb diff --git a/sonar-server/src/main/webapp/WEB-INF/db/migrate/002_index_database.rb b/sonar-server/src/main/webapp/WEB-INF/db/migrate/002_index_database.rb index 3c5cf072e35..bebf7ab3512 100644 --- a/sonar-server/src/main/webapp/WEB-INF/db/migrate/002_index_database.rb +++ b/sonar-server/src/main/webapp/WEB-INF/db/migrate/002_index_database.rb @@ -20,8 +20,6 @@ class IndexDatabase < ActiveRecord::Migration def self.up - add_index :project_measures, :snapshot_id, :name => 'project_measure_snapshot_id' - add_index :rule_failures, :snapshot_id, :name => 'rule_failure_snapshot_id' add_index :rule_failures, :rule_id, :name => 'rule_failure_rule_id' add_index :rules_parameters, :rule_id, :name => 'rules_parameters_rule_id' diff --git a/sonar-server/src/main/webapp/WEB-INF/db/migrate/053_create_events_table.rb b/sonar-server/src/main/webapp/WEB-INF/db/migrate/053_create_events_table.rb index 11e876dca4b..26a05bdf0d2 100644 --- a/sonar-server/src/main/webapp/WEB-INF/db/migrate/053_create_events_table.rb +++ b/sonar-server/src/main/webapp/WEB-INF/db/migrate/053_create_events_table.rb @@ -28,6 +28,7 @@ class CreateEventsTable < ActiveRecord::Migration t.column :event_date, :datetime, :null => true t.column :created_at, :datetime, :null => true t.column :description, :string, :limit => 3072, :null => true + t.column :data, :string, :null => true, :limit => 4000 end add_index :events, :resource_id, :name => 'events_resource_id' add_index :events, :snapshot_id, :name => 'events_snapshot_id' diff --git a/sonar-server/src/main/webapp/WEB-INF/db/migrate/059_create_properties.rb b/sonar-server/src/main/webapp/WEB-INF/db/migrate/059_create_properties.rb index a1a1f37e554..d35ad09077d 100644 --- a/sonar-server/src/main/webapp/WEB-INF/db/migrate/059_create_properties.rb +++ b/sonar-server/src/main/webapp/WEB-INF/db/migrate/059_create_properties.rb @@ -24,6 +24,7 @@ class CreateProperties < ActiveRecord::Migration t.column :prop_key, :string, :limit => 512 t.column :resource_id, :integer, :null => true t.column :text_value, :text, :null => true + t.column :user_id, :integer, :null => true end add_index :properties, :prop_key, :name => 'properties_key' end diff --git a/sonar-server/src/main/webapp/WEB-INF/db/migrate/089_set_default_project_roles.rb b/sonar-server/src/main/webapp/WEB-INF/db/migrate/089_set_default_project_roles.rb deleted file mode 100644 index 4dbc9ec57a4..00000000000 --- a/sonar-server/src/main/webapp/WEB-INF/db/migrate/089_set_default_project_roles.rb +++ /dev/null @@ -1,26 +0,0 @@ -# -# Sonar, entreprise quality control tool. -# Copyright (C) 2008-2012 SonarSource -# mailto:contact AT sonarsource DOT com -# -# Sonar 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. -# -# Sonar 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 Sonar; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 -# -# sonar 2.0 -class SetDefaultProjectRoles < ActiveRecord::Migration - - def self.up - end - -end diff --git a/sonar-server/src/main/webapp/WEB-INF/db/migrate/101_remove_null_snapshot_created_at.rb b/sonar-server/src/main/webapp/WEB-INF/db/migrate/101_remove_null_snapshot_created_at.rb deleted file mode 100644 index ce91a9a6d76..00000000000 --- a/sonar-server/src/main/webapp/WEB-INF/db/migrate/101_remove_null_snapshot_created_at.rb +++ /dev/null @@ -1,33 +0,0 @@ -# -# Sonar, entreprise quality control tool. -# Copyright (C) 2008-2012 SonarSource -# mailto:contact AT sonarsource DOT com -# -# Sonar 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. -# -# Sonar 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 Sonar; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 -# -# sonar 2.1.2 -class RemoveNullSnapshotCreatedAt < ActiveRecord::Migration - - class Snapshot < ActiveRecord::Base - end - - def self.up - Snapshot.reset_column_information - Snapshot.find(:all, :conditions => ["scope=? and created_at IS NULL and status=?", 'PRJ', 'P']).each do |s| - s.created_at = Time.now - s.save - end - end -end diff --git a/sonar-server/src/main/webapp/WEB-INF/db/migrate/110_add_events_data.rb b/sonar-server/src/main/webapp/WEB-INF/db/migrate/110_add_events_data.rb deleted file mode 100644 index cddca29e307..00000000000 --- a/sonar-server/src/main/webapp/WEB-INF/db/migrate/110_add_events_data.rb +++ /dev/null @@ -1,30 +0,0 @@ -# -# Sonar, entreprise quality control tool. -# Copyright (C) 2008-2012 SonarSource -# mailto:contact AT sonarsource DOT com -# -# Sonar 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. -# -# Sonar 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 Sonar; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 -# - -# -# Sonar 2.2 -# -class AddEventsData < ActiveRecord::Migration - - def self.up - add_column 'events', 'data', :string, :null => true, :limit => 4000 - end - -end diff --git a/sonar-server/src/main/webapp/WEB-INF/db/migrate/112_delete_checkstyle_jee_rules.rb b/sonar-server/src/main/webapp/WEB-INF/db/migrate/112_delete_checkstyle_jee_rules.rb deleted file mode 100644 index 326cbd5e3e6..00000000000 --- a/sonar-server/src/main/webapp/WEB-INF/db/migrate/112_delete_checkstyle_jee_rules.rb +++ /dev/null @@ -1,66 +0,0 @@ - # - # Sonar, entreprise quality control tool. - # Copyright (C) 2008-2012 SonarSource - # mailto:contact AT sonarsource DOT com - # - # Sonar 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. - # - # Sonar 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 Sonar; if not, write to the Free Software - # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 - # - -# -# Sonar 2.2 -# -class DeleteCheckstyleJeeRules < ActiveRecord::Migration - - class Rule < ActiveRecord::Base - end - - class ActiveRule < ActiveRecord::Base - end - - def self.up - Rule.reset_column_information - ActiveRule.reset_column_information - - delete_rule('com.puppycrawl.tools.checkstyle.checks.j2ee.EntityBeanCheck') - delete_rule('com.puppycrawl.tools.checkstyle.checks.j2ee.FinalStaticCheck') - delete_rule('com.puppycrawl.tools.checkstyle.checks.j2ee.LocalHomeInterfaceCheck') - delete_rule('com.puppycrawl.tools.checkstyle.checks.j2ee.LocalInterfaceCheck') - delete_rule('com.puppycrawl.tools.checkstyle.checks.j2ee.MessageBeanCheck') - delete_rule('com.puppycrawl.tools.checkstyle.checks.j2ee.RemoteHomeInterfaceCheck') - delete_rule('com.puppycrawl.tools.checkstyle.checks.j2ee.RemoteInterfaceCheck') - delete_rule('com.puppycrawl.tools.checkstyle.checks.j2ee.SessionBeanCheck') - delete_rule('com.puppycrawl.tools.checkstyle.checks.j2ee.ThisParameterCheck') - delete_rule('com.puppycrawl.tools.checkstyle.checks.j2ee.ThisReturnCheck') - delete_rule('com.puppycrawl.tools.checkstyle.checks.whitespace.TabCharacterCheck') - delete_rule('com.puppycrawl.tools.checkstyle.checks.RequiredRegexpCheck') - delete_rule('com.puppycrawl.tools.checkstyle.checks.javadoc.PackageHtmlCheck') - end - - def self.down - - end - - private - def self.delete_rule(rule_key) - rule=Rule.find(:first, :conditions => {:plugin_name => 'checkstyle', :plugin_rule_key => rule_key}) - if rule - say_with_time "Deleting Checkstyle rule #{rule_key}..." do - rule_id=rule.id - ActiveRule.destroy_all(["rule_id=?", rule_id]) - rule.destroy - end - end - end -end \ No newline at end of file diff --git a/sonar-server/src/main/webapp/WEB-INF/db/migrate/113_rename_clover_properties.rb b/sonar-server/src/main/webapp/WEB-INF/db/migrate/113_rename_clover_properties.rb deleted file mode 100644 index bc86dfa42c0..00000000000 --- a/sonar-server/src/main/webapp/WEB-INF/db/migrate/113_rename_clover_properties.rb +++ /dev/null @@ -1,38 +0,0 @@ -# -# Sonar, entreprise quality control tool. -# Copyright (C) 2008-2012 SonarSource -# mailto:contact AT sonarsource DOT com -# -# Sonar 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. -# -# Sonar 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 Sonar; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 -# - -# -# Sonar 2.2 -# -class RenameCloverProperties < ActiveRecord::Migration - - class Property < ActiveRecord::Base - end - - def self.up - Property.reset_column_information - property=Property.find_by_prop_key('sonar.clover.licenseV2.secured') - if property - Property.create(:prop_key => 'sonar.clover.license.secured', :text_value => property.text_value) - property.delete - end - end - -end diff --git a/sonar-server/src/main/webapp/WEB-INF/db/migrate/114_add_user_properties.rb b/sonar-server/src/main/webapp/WEB-INF/db/migrate/114_add_user_properties.rb deleted file mode 100644 index 5485895b5ad..00000000000 --- a/sonar-server/src/main/webapp/WEB-INF/db/migrate/114_add_user_properties.rb +++ /dev/null @@ -1,29 +0,0 @@ -# -# Sonar, entreprise quality control tool. -# Copyright (C) 2008-2012 SonarSource -# mailto:contact AT sonarsource DOT com -# -# Sonar 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. -# -# Sonar 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 Sonar; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 -# - -# -# Sonar 2.2 -# -class AddUserProperties < ActiveRecord::Migration - - def self.up - add_column 'properties', 'user_id', :integer, :null => true - end -end diff --git a/sonar-server/src/main/webapp/WEB-INF/db/migrate/115_create_filters.rb b/sonar-server/src/main/webapp/WEB-INF/db/migrate/115_create_filters.rb index afe9a2b7f50..841bea28ac1 100644 --- a/sonar-server/src/main/webapp/WEB-INF/db/migrate/115_create_filters.rb +++ b/sonar-server/src/main/webapp/WEB-INF/db/migrate/115_create_filters.rb @@ -23,13 +23,6 @@ # class CreateFilters < ActiveRecord::Migration - class Property < ActiveRecord::Base - end - - class ActiveFilter < ActiveRecord::Base - belongs_to :filter - end - def self.up create_table 'filters' do |t| t.column 'name', :string, :limit => 100 @@ -65,102 +58,6 @@ class CreateFilters < ActiveRecord::Migration t.column 'order_index', :integer, :null => true end - add_default_filters() - end - - private - - def self.add_default_filters - ActiveFilter.reset_column_information - Filter.reset_column_information - - projects_filter=create_projects_filter() - ActiveFilter.create(:filter => projects_filter, :user_id => nil, :order_index => 1) - - treemap_filter=create_treemap_filter() - if treemap_filter - ActiveFilter.create(:filter => treemap_filter, :user_id => nil, :order_index => 2) - end - - favourites_filter=create_favourites_filter - ActiveFilter.create(:filter => favourites_filter, :user_id => nil, :order_index => (treemap_filter ? 3 : 2)) end - def self.create_projects_filter - projects_filter=::Filter.new(:name => 'Projects', :kee => 'Projects', :shared => true, :favourites => false, :default_view => ::Filter::VIEW_LIST) - projects_filter.criteria< 'metric', :kee => 'alert_status', :order_index => 1) - projects_filter.columns.build(:family => 'name', :order_index => 2, :sort_direction => 'ASC') - - prop=property_value('sonar.core.projectsdashboard.columns') - if prop - index=3 - prop.split(";").each do |col| - fields=col.split('.') - if fields[0]=='METRIC' - projects_filter.columns.build(:family => 'metric', :kee => fields[1], :order_index => index) - index+=1 - elsif fields[0]=='BUILD_TIME' - projects_filter.columns.build(:family => 'date', :order_index => index) - index+=1 - elsif fields[0]=='LINKS' - projects_filter.columns.build(:family => 'links', :order_index => index) - index+=1 - elsif fields[0]=='LANGUAGE' - projects_filter.columns.build(:family => 'language', :order_index => index) - index+=1 - elsif fields[0]=='VERSION' - projects_filter.columns.build(:family => 'version', :order_index => index) - index+=1 - end - end - else - projects_filter.columns.build(:family => 'version', :order_index => 3) - projects_filter.columns.build(:family => 'metric', :kee => 'ncloc', :order_index => 4) - projects_filter.columns.build(:family => 'metric', :kee => 'violations_density', :order_index => 5) - projects_filter.columns.build(:family => 'date', :order_index => 6) - projects_filter.columns.build(:family => 'links', :order_index => 7) - end - projects_filter.save - projects_filter - end - - def self.create_treemap_filter - show_treemap=property_value('sonar.core.projectsdashboard.showTreemap', 'true') - if show_treemap=='true' - size_metric=property_value('sonar.core.treemap.sizemetric', 'ncloc') - color_metric=property_value('sonar.core.treemap.colormetric', 'violations_density') - - treemap_filter=::Filter.new(:name => 'Treemap', :kee => 'Treemap', :shared => true, :favourites => false, :default_view => ::Filter::VIEW_TREEMAP) - treemap_filter.criteria< 'name', :order_index => 1) - treemap_filter.columns.build(:family => 'metric', :kee => size_metric, :order_index => 2) - treemap_filter.columns.build(:family => 'metric', :kee => color_metric, :order_index => 3) - treemap_filter.save - treemap_filter - else - nil - end - end - - def self.create_favourites_filter - favourites_filter=::Filter.new(:name => 'My favourites', :kee => 'My favourites', :shared => true, :favourites => true, :default_view => ::Filter::VIEW_LIST) - favourites_filter.criteria< 'metric', :kee => 'alert_status', :order_index => 1) - favourites_filter.columns.build(:family => 'name', :order_index => 2, :sort_direction => 'ASC') - favourites_filter.columns.build(:family => 'metric', :kee => 'ncloc', :order_index => 3) - favourites_filter.columns.build(:family => 'metric', :kee => 'violations_density', :order_index => 4) - favourites_filter.columns.build(:family => 'date', :order_index => 5) - favourites_filter.save - favourites_filter - end - - def self.property_value(key, default_value=nil) - prop = Property.find(:first, :conditions => {'prop_key' => key, 'resource_id' => nil, 'user_id' => nil}) - if prop - prop.text_value || default_value - else - default_value - end - end -end +end \ No newline at end of file diff --git a/sonar-server/src/main/webapp/WEB-INF/db/migrate/116_set_resource_long_names.rb b/sonar-server/src/main/webapp/WEB-INF/db/migrate/116_set_resource_long_names.rb deleted file mode 100644 index 938f399cea6..00000000000 --- a/sonar-server/src/main/webapp/WEB-INF/db/migrate/116_set_resource_long_names.rb +++ /dev/null @@ -1,48 +0,0 @@ -# -# Sonar, entreprise quality control tool. -# Copyright (C) 2008-2012 SonarSource -# mailto:contact AT sonarsource DOT com -# -# Sonar 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. -# -# Sonar 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 Sonar; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 -# - -# -# Sonar 2.2 -# -class SetResourceLongNames < ActiveRecord::Migration - - class Project < ActiveRecord::Base - end - - def self.up - Project.reset_column_information - update('TRK') - update('BRC') - update('PAC') - update('DIR') - update('LIB') - update('CLA') - update('FIL') - update('UTS') - update('VW') - update('SVW') - end - - private - - def self.update(qualifier) - Project.connection.update("update projects set long_name=name where long_name is null and qualifier='#{qualifier}'") - end -end diff --git a/sonar-server/src/main/webapp/WEB-INF/db/migrate/117_remove_measure_sid_index.rb b/sonar-server/src/main/webapp/WEB-INF/db/migrate/117_remove_measure_sid_index.rb deleted file mode 100644 index ac184dfcdff..00000000000 --- a/sonar-server/src/main/webapp/WEB-INF/db/migrate/117_remove_measure_sid_index.rb +++ /dev/null @@ -1,30 +0,0 @@ -# -# Sonar, entreprise quality control tool. -# Copyright (C) 2008-2012 SonarSource -# mailto:contact AT sonarsource DOT com -# -# Sonar 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. -# -# Sonar 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 Sonar; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 -# - -# -# Sonar 2.2 -# -class RemoveMeasureSidIndex < ActiveRecord::Migration - - def self.up - remove_index :project_measures, :name => 'project_measure_snapshot_id' - end - -end -- 2.39.5