diff options
author | Simon Brandhof <simon.brandhof@sonarsource.com> | 2015-07-17 10:13:17 +0200 |
---|---|---|
committer | Simon Brandhof <simon.brandhof@sonarsource.com> | 2015-07-17 10:15:32 +0200 |
commit | 48697451f2b0ba517c7d1861af3897b4ace896f9 (patch) | |
tree | 99d6e30a0a7dcfddadaf7e57c32e126366e89431 /server/sonar-web | |
parent | 7f79ec13b5773949e5eb3e12da1b18cec2d086e7 (diff) | |
download | sonarqube-48697451f2b0ba517c7d1861af3897b4ace896f9.tar.gz sonarqube-48697451f2b0ba517c7d1861af3897b4ace896f9.zip |
SONAR-6716 remove data migrations of v4.4
Diffstat (limited to 'server/sonar-web')
49 files changed, 1 insertions, 2082 deletions
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/215_create_notifications.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/215_create_notifications.rb index 66fe6dec0f6..b432bc04210 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/215_create_notifications.rb +++ b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/215_create_notifications.rb @@ -25,7 +25,6 @@ class CreateNotifications < ActiveRecord::Migration def self.up create_table 'notifications' do |t| - t.column 'created_at', :datetime, :null => true t.column 'data', :binary, :null => true end end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/430_remove_notifications_created_at.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/430_remove_notifications_created_at.rb deleted file mode 100644 index 363bc5867f6..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/430_remove_notifications_created_at.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.7.1 -# -class RemoveNotificationsCreatedAt < ActiveRecord::Migration - - def self.up - remove_column('notifications', 'created_at') - end - -end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/431_migrate_users_names.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/431_migrate_users_names.rb deleted file mode 100644 index fc737725814..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/431_migrate_users_names.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 3.7.1 -# SONAR-4434 -# -class MigrateUsersNames < ActiveRecord::Migration - - class User < ActiveRecord::Base - end - - def self.up - User.reset_column_information - - User.find(:all).each do |user| - if user.name.blank? - user.name = user.login - user.updated_at = Time.now - user.send(:update_without_callbacks) - end - end - - end - -end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/440_replace_key_regexp_by_key_search_in_measure_filters_data.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/440_replace_key_regexp_by_key_search_in_measure_filters_data.rb deleted file mode 100644 index a000edc3025..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/440_replace_key_regexp_by_key_search_in_measure_filters_data.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 4.0 -# SONAR-4195 -# -class ReplaceKeyRegexpByKeySearchInMeasureFiltersData < ActiveRecord::Migration - - class MeasureFilter < ActiveRecord::Base - end - - def self.up - filters = MeasureFilter.all(:conditions => "data like '%keyRegexp%'") - filters.each do |filter| - filter.data = filter.data.sub('keyRegexp', 'keySearch') - filter.save - end - end -end - diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/443_rename_widget_sqale_pyramid_to_technical_debt_pyramid.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/443_rename_widget_sqale_pyramid_to_technical_debt_pyramid.rb deleted file mode 100644 index c151be84261..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/443_rename_widget_sqale_pyramid_to_technical_debt_pyramid.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 4.0 -# SONAR-4738 -# - -class RenameWidgetSqalePyramidToTechnicalDebtPyramid < ActiveRecord::Migration - - class Widget < ActiveRecord::Base - end - - def self.up - Widget.update_all({:widget_key => 'technical_debt_pyramid', :name => 'Technical Debt Pyramid'}, {:widget_key => 'sqalePyramid'}) - end - -end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/444_resize_timeline_widgets.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/444_resize_timeline_widgets.rb deleted file mode 100644 index 84a4516848d..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/444_resize_timeline_widgets.rb +++ /dev/null @@ -1,44 +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 4.0 -# SONAR-4416 - Migrate saved timeline chart heights to adapt to new render code (chartHeight += 100) -# - -class ResizeTimelineWidgets < ActiveRecord::Migration - - class Widget < ActiveRecord::Base - end - - class WidgetProperty < ActiveRecord::Base - end - - def self.up - Widget.reset_column_information - WidgetProperty.reset_column_information - - Widget.find(:all, :conditions => { :widget_key => 'timeline' }).each do |widget| - WidgetProperty.find(:all, :conditions => { :widget_id => widget.id, :kee => 'chartHeight' }).each do |property| - property.update_attributes!(:text_value => (property.read_attribute(:text_value).to_i + 100).to_s) - end - end - end -end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/460_add_unique_constraint_to_groups_users.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/460_add_unique_constraint_to_groups_users.rb index 8eeda227be9..e054abd8dca 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/460_add_unique_constraint_to_groups_users.rb +++ b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/460_add_unique_constraint_to_groups_users.rb @@ -23,21 +23,7 @@ # class AddUniqueConstraintToGroupsUsers < ActiveRecord::Migration - class GroupsUser < ActiveRecord::Base - end - def self.up - GroupsUser.reset_column_information - - duplicated_ids = ActiveRecord::Base.connection.select_rows('select user_id,group_id from groups_users group by user_id,group_id having count(*) > 1') - say_with_time "Remove duplications for #{duplicated_ids.size} user group associations" do - duplicated_ids.each do |user_id, group_id| - # delete all rows, then reinsert one - GroupsUser.delete_all([ "user_id=? and group_id=?", user_id, group_id ]) - ActiveRecord::Base.connection.execute("insert into groups_users (user_id,group_id) values (%s,%s)" % [user_id, group_id]) - end - end - add_index :groups_users, [:group_id, :user_id], :name => 'GROUPS_USERS_UNIQUE', :unique => true end end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/462_migrate_characteristics.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/462_migrate_characteristics.rb deleted file mode 100644 index 0d4a182d603..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/462_migrate_characteristics.rb +++ /dev/null @@ -1,142 +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 4.1 -# SONAR-4831 -# SONAR-4895 -# -class MigrateCharacteristics < ActiveRecord::Migration - - class QualityModel < ActiveRecord::Base - end - - class Characteristic < ActiveRecord::Base - end - - class CharacteristicEdge < ActiveRecord::Base - end - - class CharacteristicProperty < ActiveRecord::Base - end - - def self.up - sqale_model = QualityModel.first(:conditions => ['name=?', 'SQALE']) - - # Do nothing if there's no SQALE model installed - if sqale_model - - QualityModel.reset_column_information - Characteristic.reset_column_information - CharacteristicEdge.reset_column_information - CharacteristicProperty.reset_column_information - - now = Time.now - characteristics = Characteristic.all(:conditions => ['quality_model_id=?', sqale_model.id]) - characteristic_edges = CharacteristicEdge.all - parent_ids_by_characteristic_id = {} - characteristic_edges.each do |edge| - parent_ids_by_characteristic_id[edge.child_id] = edge.parent_id - end - - properties = CharacteristicProperty.all - properties_by_characteristic_id = {} - properties.each do |prop| - char_properties = properties_by_characteristic_id[prop.characteristic_id] || [] - char_properties << prop - properties_by_characteristic_id[prop.characteristic_id] = char_properties - end - - characteristics.each do |characteristic| - # Requirement - if characteristic.rule_id - char_properties = properties_by_characteristic_id[characteristic.id] - function = char_properties.find { |prop| prop.kee == 'remediationFunction' } if char_properties - - if char_properties && function - factor = char_properties.find { |prop| prop.kee == 'remediationFactor' } - offset = char_properties.find { |prop| prop.kee == 'offset' } - - case function.text_value - when 'linear' - characteristic.function_key = 'linear' - characteristic.factor_value = factor.value - characteristic.factor_unit = factor.text_value - characteristic.offset_value = 0.0 - characteristic.offset_unit = 'd' - - when 'linear_offset' - characteristic.function_key = 'linear_offset' - characteristic.factor_value = factor.value - characteristic.factor_unit = factor.text_value - characteristic.offset_value = offset.value - characteristic.offset_unit = offset.text_value - - # linear_threshold is depreciated and is replaced by linear - when 'linear_threshold' - characteristic.function_key = 'linear' - characteristic.factor_value = factor.value - characteristic.factor_unit = factor.text_value - characteristic.offset_value = 0.0 - characteristic.offset_unit = 'd' - - # constant_resource is no more managed anymore, it has to be disabled - when 'constant_resource' - characteristic.enabled = false - characteristic.function_key = 'constant_resource' - characteristic.factor_value = 0.0 - characteristic.factor_unit = 'd' - characteristic.offset_value = 0.0 - characteristic.offset_unit = 'd' - - end - # requirement without properties or without remediationFunction has to be disabled - else - characteristic.enabled = false - end - end - - parent_id = parent_ids_by_characteristic_id[characteristic.id] - # Not for root characteristics - if parent_id - characteristic.parent_id = parent_id - # Requirements - if characteristic.rule_id - root_id = parent_ids_by_characteristic_id[characteristic.parent_id] - if root_id - characteristic.root_id = root_id - else - # requirement linked to a root characteristic has to be disabled - characteristic.enabled = false - end - else - # Characteristics has same root_id as parent_id - characteristic.root_id = parent_id - end - end - characteristic.created_at = now - characteristic.updated_at = now - characteristic.save - end - end - end - -end - diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/466_add_network_use_sub_characteristic.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/466_add_network_use_sub_characteristic.rb deleted file mode 100644 index 1776eae0a56..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/466_add_network_use_sub_characteristic.rb +++ /dev/null @@ -1,47 +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. -# - -# -# SonarQube 4.1 -# SONAR-4870 -# - -class AddNetworkUseSubCharacteristic < ActiveRecord::Migration - - class Characteristic < ActiveRecord::Base - end - - def self.up - Characteristic.reset_column_information - - # On an empty DB, there are no characteristics, they're all gonna be created after (so new characteristics has always to be also added in the technical-debt-model.xml file) - if Characteristic.all.size > 0 - efficiency = Characteristic.first(:conditions => ['kee=? AND enabled=?', 'EFFICIENCY', true]) - network_use = Characteristic.first(:conditions => ['name=? AND enabled=?', 'Network use ', true]) - - # The Efficiency characteristic can have been deleted from the SQALE plugin - # And the Network use can already been created - if efficiency && !network_use - Characteristic.create(:kee => 'NETWORK_USE_EFFICIENCY', :name => 'Network use', :enabled => true, :parent_id => efficiency.id, :root_id => efficiency.id) if efficiency - end - end - end - -end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/481_copy_rule_notes_to_rules.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/481_copy_rule_notes_to_rules.rb deleted file mode 100644 index 0d1dd5cf4c2..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/481_copy_rule_notes_to_rules.rb +++ /dev/null @@ -1,80 +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 4.2 -# SONAR-4923 -# Copy rule_notes (resp. active_rule_notes) contents to rules (resp. active_rules) -# -class CopyRuleNotesToRules < ActiveRecord::Migration - - class Rule < ActiveRecord::Base - end - - class RuleNote < ActiveRecord::Base - end - - class ActiveRule < ActiveRecord::Base - end - - class ActiveRuleNote < ActiveRecord::Base - end - - def self.up - Rule.reset_column_information - RuleNote.reset_column_information - ActiveRule.reset_column_information - ActiveRuleNote.reset_column_information - - rules = {} - Rule.all.each do |rule| - rules[rule.id] = rule - end - - RuleNote.all.each do |note| - rule = rules[note.rule_id] - if rule - rule.note_created_at = note.created_at - rule.note_updated_at = note.updated_at - rule.note_user_login = note.user_login - rule.note_data = note.data - rule.save - end - end - - active_rules = {} - ActiveRule.all.each do |rule| - active_rules[rule.id] = rule - end - - ActiveRuleNote.all.each do |note| - active_rule = active_rules[note.active_rule_id] - if active_rule - active_rule.note_created_at = note.created_at - active_rule.note_updated_at = note.updated_at - active_rule.note_user_login = note.user_login - active_rule.note_data = note.data - active_rule.save - end - end - end - -end - diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/482_purge_group_roles.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/482_purge_group_roles.rb deleted file mode 100644 index b6d3d169e71..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/482_purge_group_roles.rb +++ /dev/null @@ -1,44 +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. -# - -# -# SonarQube 4.2 -# See SONAR-4950 - reverted. Unique constraint is not created but duplications are still purged. -# -class PurgeGroupRoles < ActiveRecord::Migration - - class GroupRole < ActiveRecord::Base - end - - def self.up - GroupRole.reset_column_information - - duplicated_ids = ActiveRecord::Base.connection.select_rows('select group_id,resource_id,role from group_roles group by group_id,resource_id,role having count(*) > 1') - say_with_time "Remove #{duplicated_ids.size} duplicated group roles" do - duplicated_ids.each do |fields| - rows = GroupRole.find(:all, :conditions => {:group_id => fields[0], :resource_id => fields[1], :role => fields[2]}) - # delete all rows except the last one - rows[0...-1].each do |row| - GroupRole.delete(row.id) - end - end - end - end -end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/484_copy_rule_parameters_name_to_active_rule_parameters.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/484_copy_rule_parameters_name_to_active_rule_parameters.rb deleted file mode 100644 index 09c4a649b5e..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/484_copy_rule_parameters_name_to_active_rule_parameters.rb +++ /dev/null @@ -1,47 +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. -# - -# -# SonarQube 4.2 -# SONAR-4950 -# -class CopyRuleParametersNameToActiveRuleParameters < ActiveRecord::Migration - - class ActiveRuleParameter < ActiveRecord::Base - end - - class RulesParameter < ActiveRecord::Base - end - - def self.up - ActiveRuleParameter.reset_column_information - - rule_params_by_id = {} - RulesParameter.all.each do |rule_param| - rule_params_by_id[rule_param.id] = rule_param - end - - ActiveRuleParameter.all.each do |active_rule_parameter| - rule_param = rule_params_by_id[active_rule_parameter.rules_parameter_id] - active_rule_parameter.rules_parameter_key = rule_param.name if rule_param - active_rule_parameter.save - end - end -end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/485_update_rules_without_severity.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/485_update_rules_without_severity.rb deleted file mode 100644 index 86a27c1c8ad..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/485_update_rules_without_severity.rb +++ /dev/null @@ -1,34 +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. -# - -# -# SonarQube 4.2 -# SONAR-4993 -# -class UpdateRulesWithoutSeverity < ActiveRecord::Migration - - class Rule < ActiveRecord::Base - end - - def self.up - Rule.reset_column_information - Rule.update_all({:priority => 2, :updated_at => Time.now}, 'priority IS NULL') - end -end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/490_migrate_package_keys.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/490_migrate_package_keys.rb deleted file mode 100644 index d17ed8c28c4..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/490_migrate_package_keys.rb +++ /dev/null @@ -1,31 +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. -# - -# -# SonarQube 4.2 -# SONAR-926 -# -class MigratePackageKeys < ActiveRecord::Migration - - def self.up - execute_java_migration('org.sonar.server.db.migrations.v42.PackageKeysMigrationStep') - end - -end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/493_delete_display_treemap_from_measure_filters.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/493_delete_display_treemap_from_measure_filters.rb deleted file mode 100644 index 9710fabe06a..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/493_delete_display_treemap_from_measure_filters.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. -# - -# -# SonarQube 4.2 -# SONAR-4997 -# -class DeleteDisplayTreemapFromMeasureFilters < ActiveRecord::Migration - - class MeasureFilter < ActiveRecord::Base - end - - def self.up - filters = MeasureFilter.all(:conditions => "data like '%display=treemap%'") - filters.each do |filter| - filter.data = filter.data.sub('display=treemap', '') - filter.save - end - end -end - diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/494_delete_properties_on_unknown_components.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/494_delete_properties_on_unknown_components.rb deleted file mode 100644 index 587ca29d79d..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/494_delete_properties_on_unknown_components.rb +++ /dev/null @@ -1,34 +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. -# - -# -# SonarQube 4.2 -# SONAR-5013 -# -class DeletePropertiesOnUnknownComponents < ActiveRecord::Migration - - class Property < ActiveRecord::Base - end - - def self.up - Property.delete_all('resource_id IS NOT NULL AND resource_id NOT IN (SELECT id FROM projects)') - end -end - diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/495_migrate_base_id_to_base_from_measure_filters.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/495_migrate_base_id_to_base_from_measure_filters.rb deleted file mode 100644 index 9bee50e2cda..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/495_migrate_base_id_to_base_from_measure_filters.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. -# - -# -# SonarQube 4.2 -# SONAR-4921 -# -class MigrateBaseIdToBaseFromMeasureFilters < ActiveRecord::Migration - - class MeasureFilter < ActiveRecord::Base - end - - def self.up - filters = MeasureFilter.all(:conditions => "data LIKE '%baseId=%'") - filters.each do |filter| - matchBaseId = filter.data.match(/baseId=(\d+)/) - if matchBaseId - projectId = matchBaseId[1] - project = Project.find_by_id(projectId) - # If project exists, we replace the condition using project id by the condition using project key, otherwise we removed the condition - filter.data = filter.data.sub(/baseId=\d+/, project ? "base=#{project.kee}" : '') - filter.save - end - end - end -end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/496_delete_language_property.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/496_delete_language_property.rb deleted file mode 100644 index 7f9f82d76a7..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/496_delete_language_property.rb +++ /dev/null @@ -1,34 +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. -# - -# -# SonarQube 4.2 -# SONAR-926 -# The property sonar.language must not be set in global settings -# -class DeleteLanguageProperty < ActiveRecord::Migration - - class Property < ActiveRecord::Base - end - - def self.up - Property.delete_all("prop_key = 'sonar.language'") - end -end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/497_update_issue_message_by_rule_name_when_no_message.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/497_update_issue_message_by_rule_name_when_no_message.rb deleted file mode 100644 index 3eb73f963f4..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/497_update_issue_message_by_rule_name_when_no_message.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. -# - -# -# SonarQube 4.2 -# SONAR-4785 -# -class UpdateIssueMessageByRuleNameWhenNoMessage < ActiveRecord::Migration - - def self.up - execute_java_migration('org.sonar.server.db.migrations.v42.CompleteIssueMessageMigrationStep') - end -end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/498_remove_duplicate_active_rules.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/498_remove_duplicate_active_rules.rb deleted file mode 100644 index f9710ba9496..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/498_remove_duplicate_active_rules.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. -# - -# -# SonarQube 4.2 -# SONAR-5067 -# -class RemoveDuplicateActiveRules < ActiveRecord::Migration - - class ActiveRuleParameters < ActiveRecord::Base - end - - class ActiveRule < ActiveRecord::Base - end - - def self.up - # Search for all rules activated many times on a same profile - rule_actived_many_times_on_same_profile = ActiveRule.all( - :select => 'rule_id,profile_id', - :group => 'rule_id,profile_id', - :having => 'COUNT(*) > 1' - ) - - rule_actived_many_times_on_same_profile.each do |duplicate_active_rule| - # Search for all duplication on current rule and profile - active_rules = ActiveRule.all( - :conditions => {:rule_id => duplicate_active_rule.rule_id, :profile_id => duplicate_active_rule.profile_id} - ) - # Remove duplication, keep only one active rule (first one) - active_rules.drop(1).each do |active_rule| - ActiveRuleParameters.delete_all(:active_rule_id => active_rule.id) - active_rule.delete - end - end - end - -end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/512_convert_alerts_to_quality_gates.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/512_convert_alerts_to_quality_gates.rb deleted file mode 100644 index 408a8ebcafb..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/512_convert_alerts_to_quality_gates.rb +++ /dev/null @@ -1,78 +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. -# - -# -# SonarQube 4.3 -# -class ConvertAlertsToQualityGates < ActiveRecord::Migration - - class RulesProfile < ActiveRecord::Base - end - - class Alert < ActiveRecord::Base - end - - class QualityGate < ActiveRecord::Base - end - - class QualityGateCondition < ActiveRecord::Base - end - - def self.up - - RulesProfile.reset_column_information - Alert.reset_column_information - QualityGate.reset_column_information - QualityGateCondition.reset_column_information - - alerts = {} - Alert.all.each do |alert| - alerts[alert.profile_id] ||= [] - alerts[alert.profile_id].push alert - end - - new_operators = { - '=' => 'EQ', - '!=' => 'NE', - '>' => 'GT', - '<' => 'LT' - } - - RulesProfile.all.each do |profile| - if alerts.has_key?(profile.id) - qgate_name = profile.name + ' - ' + profile.language - - # This block allows re-execution in case of failure - old_qgate = QualityGate.find_by_name(qgate_name) - unless old_qgate.nil? - QualityGateCondition.destroy_all(:qgate_id => old_qgate.id) - old_qgate.destroy - end - - qgate = QualityGate.create(:name => qgate_name) - alerts[profile.id].each do |alert| - QualityGateCondition.create(:qgate_id => qgate.id, :metric_id => alert.metric_id, :operator => new_operators[alert.operator], - :value_warning => alert.value_warning, :value_error => alert.value_error, :period => alert.period) - end - end - end - end - -end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/513_convert_issue_debt_to_minutes.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/513_convert_issue_debt_to_minutes.rb deleted file mode 100644 index c02eaf1a2b5..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/513_convert_issue_debt_to_minutes.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. -# - -# -# SonarQube 4.3 -# SONAR-4996 -# -class ConvertIssueDebtToMinutes < ActiveRecord::Migration - - def self.up - execute_java_migration('org.sonar.server.db.migrations.v43.ConvertIssueDebtToMinutesMigrationStep') - end -end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/514_update_issue_changelog_debt_to_minutes.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/514_update_issue_changelog_debt_to_minutes.rb deleted file mode 100644 index 5b755a77e44..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/514_update_issue_changelog_debt_to_minutes.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. -# - -# -# SonarQube 4.3 -# SONAR-4996 -# -class UpdateIssueChangelogDebtToMinutes < ActiveRecord::Migration - - def self.up - execute_java_migration('org.sonar.server.db.migrations.v43.IssueChangelogMigrationStep') - end -end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/515_update_measures_debt_to_minutes.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/515_update_measures_debt_to_minutes.rb deleted file mode 100644 index fe5ed6bbec6..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/515_update_measures_debt_to_minutes.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. -# - -# -# SonarQube 4.3 -# SONAR-4996 -# -class UpdateMeasuresDebtToMinutes < ActiveRecord::Migration - - def self.up - execute_java_migration('org.sonar.server.db.migrations.v43.TechnicalDebtMeasuresMigrationStep') - end -end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/516_update_development_cost_to_minutes.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/516_update_development_cost_to_minutes.rb deleted file mode 100644 index 39eca632abb..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/516_update_development_cost_to_minutes.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. -# - -# -# SonarQube 4.3 -# SONAR-4996 -# -class UpdateDevelopmentCostToMinutes < ActiveRecord::Migration - - def self.up - execute_java_migration('org.sonar.server.db.migrations.v43.DevelopmentCostMeasuresMigrationStep') - end -end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/517_update_work_units_by_size_point_property_to_minutes.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/517_update_work_units_by_size_point_property_to_minutes.rb deleted file mode 100644 index 212d76364ad..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/517_update_work_units_by_size_point_property_to_minutes.rb +++ /dev/null @@ -1,58 +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. -# - -# -# SonarQube 4.3 -# SONAR-4996 -# -class UpdateWorkUnitsBySizePointPropertyToMinutes < ActiveRecord::Migration - - class Property < ActiveRecord::Base - - end - - def self.up - hours_in_day_prop = Property.find_by_prop_key('sonar.technicalDebt.hoursInDay') - hours_in_day = hours_in_day_prop && hours_in_day_prop.text_value ? hours_in_day_prop.text_value.to_i : 8 - work_units_by_size_point = Property.find_by_prop_key('workUnitsBySizePoint') - if work_units_by_size_point && work_units_by_size_point.text_value && work_units_by_size_point.text_value.to_f - work_units_by_size_point.text_value = convert_days_to_minutes(work_units_by_size_point.text_value.to_f, hours_in_day).to_s - work_units_by_size_point.save! - end - - language_specific_parameters = Property.find_by_prop_key('languageSpecificParameters') - if language_specific_parameters - values = language_specific_parameters.text_value.split(',') - values.each do |value| - prop = Property.find_by_prop_key('languageSpecificParameters.' + value + '.man_days') - if prop && prop.text_value && prop.text_value.to_f - prop.text_value = convert_days_to_minutes(prop.text_value.to_f, hours_in_day).to_s - prop.save! - end - end - end - end - - def self.convert_days_to_minutes(hours, hours_in_day) - result = hours * hours_in_day * 60 - # Round value - result.ceil - end -end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/518_update_conditions_on_debt_to_minutes.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/518_update_conditions_on_debt_to_minutes.rb deleted file mode 100644 index a2cca32e581..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/518_update_conditions_on_debt_to_minutes.rb +++ /dev/null @@ -1,65 +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. -# - -# -# SonarQube 4.3 -# SONAR-4996 -# -class UpdateConditionsOnDebtToMinutes < ActiveRecord::Migration - - class Property < ActiveRecord::Base - - end - - class QualityGateCondition < ActiveRecord::Base - - end - - class Metric < ActiveRecord::Base - - end - - def self.up - Property.reset_column_information - Metric.reset_column_information - QualityGateCondition.reset_column_information - - hours_in_day_prop = Property.find_by_prop_key('sonar.technicalDebt.hoursInDay') - hours_in_day = hours_in_day_prop && hours_in_day_prop.text_value ? hours_in_day_prop.text_value.to_i : 8 - - metrics = Metric.find(:all, :conditions => ['name in (?)', ['sqale_index', 'new_technical_debt', - 'sqale_effort_to_grade_a', 'sqale_effort_to_grade_b', 'sqale_effort_to_grade_c', 'sqale_effort_to_grade_d', - 'blocker_remediation_cost', 'critical_remediation_cost', 'major_remediation_cost', 'minor_remediation_cost', - 'info_remediation_cost']]) - conditions = QualityGateCondition.all(:conditions => ['metric_id in (?)', metrics.map { |m| m.id } ]) - - conditions.each do |condition| - condition.value_error = convert_days_to_minutes(condition.value_error.to_f, hours_in_day) unless condition.value_error.blank? - condition.value_warning = convert_days_to_minutes(condition.value_warning.to_f, hours_in_day) unless condition.value_warning.blank? - condition.save! - end - end - - def self.convert_days_to_minutes(hours, hours_in_day) - result = hours * hours_in_day * 60 - # Round value - result.ceil - end -end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/519_update_measure_filters_on_debt_to_minutes.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/519_update_measure_filters_on_debt_to_minutes.rb deleted file mode 100644 index 0a45158a190..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/519_update_measure_filters_on_debt_to_minutes.rb +++ /dev/null @@ -1,69 +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. -# - -# -# SonarQube 4.3 -# SONAR-4996 -# -class UpdateMeasureFiltersOnDebtToMinutes < ActiveRecord::Migration - - class Property < ActiveRecord::Base - - end - - class MeasureFilter < ActiveRecord::Base - - end - - def self.up - Property.reset_column_information - MeasureFilter.reset_column_information - - hours_in_day_prop = Property.find_by_prop_key('sonar.technicalDebt.hoursInDay') - hours_in_day = hours_in_day_prop && hours_in_day_prop.text_value ? hours_in_day_prop.text_value.to_i : 8 - - filters = MeasureFilter.all(:conditions => "data LIKE '%_metric=sqale_index%' OR data LIKE '%_metric=new_technical_debt%'" + - " OR data LIKE '%_metric=sqale_effort_to_grade_a%' OR data LIKE '%_metric=sqale_effort_to_grade_b%' OR data LIKE '%_metric=sqale_effort_to_grade_c%' " + - " OR data LIKE '%_metric=sqale_effort_to_grade_d%'"+ - " OR data LIKE '%_metric=blocker_remediation_cost%' OR data LIKE '%_metric=critical_remediation_cost%' OR data LIKE '%_metric=major_remediation_cost%' "+ - " OR data LIKE '%_metric=minor_remediation_cost%' OR data LIKE '%_metric=info_remediation_cost%'" - ) - filters.each do |filter| - data = filter.data.to_s - data.scan(/c(\d+)_metric=(sqale_index|new_technical_debt|sqale_effort_to_grade_a|sqale_effort_to_grade_b|sqale_effort_to_grade_c|sqale_effort_to_grade_d|blocker_remediation_cost - |critical_remediation_cost|major_remediation_cost|minor_remediation_cost|info_remediation_cost)/) do |find| - index = find[0] - # Update filter value when it's before a '|' or at the end of the string - value = /c#{index}_val=((.+?)(\||\z))?/.match(data)[2] - if value - new_value = convert_days_to_minutes(value.to_f, hours_in_day) - filter.data = filter.data.sub("c#{index}_val=#{value}", "c#{index}_val=#{new_value}") - end - end - filter.save! - end - end - - def self.convert_days_to_minutes(hours, hours_in_day) - result = hours * hours_in_day * 60 - # Round value - result.ceil - end -end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/521_update_requirement_measures.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/521_update_requirement_measures.rb deleted file mode 100644 index 436e864ae63..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/521_update_requirement_measures.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. -# - -# -# SonarQube 4.3 -# SONAR-5056 -# -class UpdateRequirementMeasures < ActiveRecord::Migration - - def self.up - execute_java_migration('org.sonar.server.db.migrations.v43.RequirementMeasuresMigrationStep') - end -end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/523_add_characteristic_reusability_and_sub_characteristic_resource.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/523_add_characteristic_reusability_and_sub_characteristic_resource.rb deleted file mode 100644 index 3d956e6126d..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/523_add_characteristic_reusability_and_sub_characteristic_resource.rb +++ /dev/null @@ -1,69 +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. -# - -# -# SonarQube 4.3 -# SONAR-5180 -# -class AddCharacteristicReusabilityAndSubCharacteristicResource < ActiveRecord::Migration - - class Characteristic < ActiveRecord::Base - end - - def self.up - Characteristic.reset_column_information - - # On an empty DB, there are no characteristics, they're all gonna be created after - if Characteristic.all.size > 0 - create_characteristic_reusability_and_its_sub_characteristics - create_sub_characteristic_resource - end - end - - def self.create_characteristic_reusability_and_its_sub_characteristics - # 'Reusability' is the new characteristic, it has two sub characteristics : 'Modularity' and 'Transportability' - reusability = Characteristic.first(:conditions => ['kee=? AND enabled=?', 'REUSABILITY', true]) - modularity = Characteristic.first(:conditions => ['kee=? AND enabled=?', 'MODULARITY', true]) - transportability = Characteristic.first(:conditions => ['kee=? AND enabled=?', 'TRANSPORTABILITY', true]) - - unless reusability - # Reusability should become the first characteristic - reusability = Characteristic.create(:name => 'Reusability', :kee => 'REUSABILITY', :characteristic_order => 1, :enabled => true) - # So all other characteristics have to moved down - Characteristic.all(:conditions => ['enabled=? AND parent_id IS NULL AND rule_id IS NULL', true]).each do |c| - c.characteristic_order = c.characteristic_order + 1 - c.save! - end - end - - Characteristic.create(:name => 'Modularity', :kee => 'MODULARITY', :parent_id => reusability.id, :enabled => true) unless modularity - Characteristic.create(:name => 'Transportability', :kee => 'TRANSPORTABILITY', :parent_id => reusability.id, :enabled => true) unless transportability - end - - def self.create_sub_characteristic_resource - # New sub characteristic 'Resource' (under characteristic 'Reliability') - resource = Characteristic.first(:conditions => ['kee=? AND enabled=?', 'RESOURCE_RELIABILITY', true]) - unless resource - reliability = Characteristic.first(:conditions => ['kee=? AND enabled=?', 'RELIABILITY', true]) - Characteristic.create(:name => 'Resource', :kee => 'RESOURCE_RELIABILITY', :parent_id => reliability.id, :enabled => true) if reliability - end - end - -end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/524_update_sub_characteristic_network_use_key.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/524_update_sub_characteristic_network_use_key.rb deleted file mode 100644 index eed522f91ec..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/524_update_sub_characteristic_network_use_key.rb +++ /dev/null @@ -1,44 +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. -# - -# -# SonarQube 4.3 -# SONAR-5180 -# -class UpdateSubCharacteristicNetworkUseKey < ActiveRecord::Migration - - class Characteristic < ActiveRecord::Base - end - - def self.up - Characteristic.reset_column_information - - # On an empty DB, there are no characteristics, they're all gonna be created after - if Characteristic.all.size > 0 - # NETWORK_USE was created with a bad key in the migration 466 - network_use = Characteristic.first(:conditions => ['kee=? AND enabled=?', 'NETWORK_USE_EFFICIENCY', true]) - if network_use - network_use.kee = 'NETWORK_USE' - network_use.save! - end - end - end - -end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/525_update_not_resolved_issues_on_removed_components.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/525_update_not_resolved_issues_on_removed_components.rb deleted file mode 100644 index 778d82658a0..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/525_update_not_resolved_issues_on_removed_components.rb +++ /dev/null @@ -1,31 +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. -# - -# -# SonarQube 4.3 -# SONAR-5200 -# -class UpdateNotResolvedIssuesOnRemovedComponents < ActiveRecord::Migration - - def self.up - execute_java_migration('org.sonar.server.db.migrations.v43.NotResolvedIssuesOnRemovedComponentsMigrationStep') - end - -end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/526_remove_unshared_active_dashboards.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/526_remove_unshared_active_dashboards.rb deleted file mode 100644 index 6c35790ce4e..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/526_remove_unshared_active_dashboards.rb +++ /dev/null @@ -1,44 +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. -# - -# -# SonarQube 4.3 -# SONAR-4979 -# -class RemoveUnsharedActiveDashboards < ActiveRecord::Migration - - class Dashboard < ActiveRecord::Base - set_table_name 'dashboards' - end - - class ActiveDashboard < ActiveRecord::Base - set_table_name 'active_dashboards' - belongs_to :dashboard, :class_name => 'Dashboard' - end - - def self.up - Dashboard.reset_column_information - ActiveDashboard.reset_column_information - - # Delete every active_dashboards linked on unshared dashboard not owned by the user - ActiveDashboard.all(:joins => 'inner join dashboards on dashboards.id=active_dashboards.dashboard_id', :conditions => ['dashboards.shared=? AND active_dashboards.user_id<>dashboards.user_id', false]).each {|ad| ad.delete} - end - -end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/530_merge_measure_data_into_project_measures.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/530_merge_measure_data_into_project_measures.rb index 401a74ffb42..78e35172f2c 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/530_merge_measure_data_into_project_measures.rb +++ b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/530_merge_measure_data_into_project_measures.rb @@ -34,18 +34,7 @@ class MergeMeasureDataIntoProjectMeasures < ActiveRecord::Migration ActiveRecord::Base.connection.commit_db_transaction end ProjectMeasure.reset_column_information - execute_java_migration('org.sonar.server.db.migrations.v44.MeasureDataMigrationStep') drop_table(:measure_data) end - - def self.execute_ddl(message, ddl) - begin - say_with_time(message) do - ActiveRecord::Base.connection.execute(ddl) - end - rescue - # already executed - end - end - + end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/531_update_issues_action_plan_key_on_removed_action_plan.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/531_update_issues_action_plan_key_on_removed_action_plan.rb deleted file mode 100644 index 479e36534ee..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/531_update_issues_action_plan_key_on_removed_action_plan.rb +++ /dev/null @@ -1,31 +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. -# - -# -# SonarQube 4.4 -# SONAR-5218 -# -class UpdateIssuesActionPlanKeyOnRemovedActionPlan < ActiveRecord::Migration - - def self.up - execute_java_migration('org.sonar.server.db.migrations.v44.IssueActionPlanKeyMigrationStep') - end - -end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/539_insert_active_rule_dates.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/539_insert_active_rule_dates.rb deleted file mode 100644 index 0c2e5c8fe30..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/539_insert_active_rule_dates.rb +++ /dev/null @@ -1,41 +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. -# - -# -# SonarQube 4.4 -# SONAR-5007 -# -class InsertActiveRuleDates < ActiveRecord::Migration - - class ActiveRule < ActiveRecord::Base - end - - def self.up - ActiveRule.reset_column_information - now = Time.now - ActiveRule.find(:all).each do |active_rule| - active_rule.created_at=now - active_rule.updated_at=now - active_rule.save! - end - end - -end - diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/541_add_unique_index_on_active_rule_key.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/541_add_unique_index_on_active_rule_key.rb index 9885d253f77..730847f5aa6 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/541_add_unique_index_on_active_rule_key.rb +++ b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/541_add_unique_index_on_active_rule_key.rb @@ -25,35 +25,7 @@ class AddUniqueIndexOnActiveRuleKey < ActiveRecord::Migration - class ActiveRuleParameter < ActiveRecord::Base - end - - class ActiveRule < ActiveRecord::Base - end - def self.up - ActiveRule.reset_column_information - ActiveRuleParameter.reset_column_information - - # Search for all rules activated many times on a same profile - rule_actived_many_times_on_same_profile = ActiveRule.all( - :select => 'rule_id,profile_id', - :group => 'rule_id,profile_id', - :having => 'COUNT(*) > 1' - ) - - rule_actived_many_times_on_same_profile.each do |duplicate_active_rule| - # Search for all duplication on current rule and profile - active_rules = ActiveRule.all( - :conditions => {:rule_id => duplicate_active_rule.rule_id, :profile_id => duplicate_active_rule.profile_id} - ) - # Remove duplication, keep only one active rule (first one) - active_rules.drop(1).each do |active_rule| - ActiveRuleParameter.delete_all(:active_rule_id => active_rule.id) - active_rule.delete - end - end - add_index :active_rules, [:profile_id, :rule_id], :name => 'uniq_profile_rule_ids', :unique => true end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/545_rename_rules_cardinality_to_is_template.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/545_rename_rules_cardinality_to_is_template.rb index c8203cba112..c6eb7b3a858 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/545_rename_rules_cardinality_to_is_template.rb +++ b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/545_rename_rules_cardinality_to_is_template.rb @@ -30,10 +30,6 @@ class RenameRulesCardinalityToIsTemplate < ActiveRecord::Migration def self.up add_column 'rules', 'is_template', :boolean, :null => false, :default => false Rule.reset_column_information - Rule.all.each do |r| - r.is_template = r.cardinality == 'MULTIPLE' - r.save! - end remove_column 'rules', 'cardinality' end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/546_inverse_rule_key_index.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/546_inverse_rule_key_index.rb deleted file mode 100644 index 6cf46b03186..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/546_inverse_rule_key_index.rb +++ /dev/null @@ -1,99 +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. -# - -# -# SQ 4.4 -# SONAR-5001 -# -require 'set' -class InverseRuleKeyIndex < ActiveRecord::Migration - - - class ActiveRule < ActiveRecord::Base - set_table_name 'active_rules' - end - - class Characteristic < ActiveRecord::Base - set_table_name 'characteristics' - end - - class Issue < ActiveRecord::Base - set_table_name 'issues' - end - - class ActiveRuleChange < ActiveRecord::Base - set_table_name 'active_rule_changes' - end - - class ProjectMeasure < ActiveRecord::Base - set_table_name 'project_measures' - end - - class Rule < ActiveRecord::Base - end - - class RuleParameter < ActiveRecord::Base - set_table_name 'rules_parameters' - end - - def self.up - begin - remove_index :rules, :name => 'rules_plugin_key_and_name' - rescue - #ignore - end - - # rows can be duplicated because the unique index was sometimes missing - delete_duplicated_rules - - add_index :rules, [:plugin_name, :plugin_rule_key], :unique => true, :name => 'rules_repo_key' - end - - private - def self.delete_duplicated_rules - ActiveRule.reset_column_information - ActiveRuleChange.reset_column_information - Characteristic.reset_column_information - Issue.reset_column_information - ProjectMeasure.reset_column_information - Rule.reset_column_information - RuleParameter.reset_column_information - - say_with_time 'Delete duplicated rules' do - existing_keys = Set.new - rules=Rule.find(:all, :select => 'id,plugin_name,plugin_rule_key', :order => 'id') - rules.each do |rule| - key = "#{rule.plugin_name}:#{rule.plugin_rule_key}" - if existing_keys.include?(key) - say "Delete duplicated rule '#{key}' (id=#{rule.id})" - ActiveRule.delete_all(['rule_id=?', rule.id]) - ActiveRuleChange.delete_all(['rule_id=?', rule.id]) - Characteristic.delete_all(['rule_id=?', rule.id]) - Issue.delete_all(['rule_id=?', rule.id]) - ProjectMeasure.delete_all(['rule_id=?', rule.id]) - RuleParameter.delete_all(['rule_id=?', rule.id]) - rule.destroy - else - existing_keys.add(key) - end - end - end - end -end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/547_merge_custom_rules_extended_description_with_description.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/547_merge_custom_rules_extended_description_with_description.rb deleted file mode 100644 index b8f2377212c..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/547_merge_custom_rules_extended_description_with_description.rb +++ /dev/null @@ -1,44 +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. -# - -# -# SonarQube 4.4 -# SONAR-5397 -# -class MergeCustomRulesExtendedDescriptionWithDescription < ActiveRecord::Migration - - class Rule < ActiveRecord::Base - end - - def self.up - Rule.reset_column_information - Rule.all(:conditions => ['template_id IS NOT NULL and note_data IS NOT NULL']).each do |r| - unless r.note_data.blank? - r.description += '<br/>' + r.note_data - r.note_data = nil - r.note_user_login = nil - r.note_created_at = nil - r.note_updated_at = nil - r.save! - end - end - end - -end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/549_feed_qprofile_keys.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/549_feed_qprofile_keys.rb index d2b579ccbd8..81724162b26 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/549_feed_qprofile_keys.rb +++ b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/549_feed_qprofile_keys.rb @@ -25,8 +25,6 @@ class FeedQprofileKeys < ActiveRecord::Migration def self.up - execute_java_migration('org.sonar.server.db.migrations.v44.FeedQProfileKeysMigrationStep') - # set as non-null and unique change_column :rules_profiles, :kee, :string, :limit => 255, :null => false add_index :rules_profiles, :kee, :name => 'uniq_qprof_key', :unique => true diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/550_convert_profile_measures.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/550_convert_profile_measures.rb deleted file mode 100644 index 1543cc3fadf..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/550_convert_profile_measures.rb +++ /dev/null @@ -1,41 +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. -# - -# -# SonarQube 4.4 -# SONAR-5218 -# -class ConvertProfileMeasures < ActiveRecord::Migration - - class Metric < ActiveRecord::Base - end - - def self.up - execute_java_migration('org.sonar.server.db.migrations.v44.ConvertProfileMeasuresMigrationStep') - - Metric.reset_column_information - metric = Metric.find_by_name('profile') - if metric - metric.name='quality_profiles' - metric.save! - end - end - -end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/551_update_logs_to_activities.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/551_update_logs_to_activities.rb deleted file mode 100644 index d11201aee8e..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/551_update_logs_to_activities.rb +++ /dev/null @@ -1,31 +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. -# - -# -# SonarQube 4.4 -# SONAR-5218 -# -class UpdateLogsToActivities < ActiveRecord::Migration - - def self.up - execute_java_migration('org.sonar.server.db.migrations.v44.ChangeLogMigrationStep') - end - -end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/553_feed_qprofile_dates.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/553_feed_qprofile_dates.rb deleted file mode 100644 index f8cc4868a22..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/553_feed_qprofile_dates.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. -# - -# -# SonarQube 4.4 -# -class FeedQprofileDates < ActiveRecord::Migration - - def self.up - execute_java_migration 'org.sonar.server.db.migrations.v44.FeedQProfileDatesMigrationStep' - end - -end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/554_add_missing_user_unique_index.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/554_add_missing_user_unique_index.rb deleted file mode 100644 index 3101ce1beef..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/554_add_missing_user_unique_index.rb +++ /dev/null @@ -1,108 +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. -# - -# -# SonarQube 4.4 -# See SONAR-5405 -# -require 'set' - -class AddMissingUserUniqueIndex < ActiveRecord::Migration - - class User < ActiveRecord::Base - end - - class UserRole < ActiveRecord::Base - end - - class Property < ActiveRecord::Base - set_table_name 'properties' - end - - class GroupsUsers < ActiveRecord::Base - set_table_name 'groups_users' - end - - class Dashboard < ActiveRecord::Base - set_table_name 'dashboards' - has_many :active_dashboards, :dependent => :destroy, :inverse_of => :dashboard - end - - class ActiveDashboard < ActiveRecord::Base - set_table_name 'active_dashboards' - belongs_to :dashboard - end - - class PermTemplatesUser < ActiveRecord::Base - set_table_name 'perm_templates_users' - end - - class MeasureFilter < ActiveRecord::Base - set_table_name 'measure_filters' - has_many :measure_filter_favourites, :dependent => :delete_all - end - - class MeasureFilterFavourite < ActiveRecord::Base - set_table_name 'measure_filter_favourites' - belongs_to :measure_filter - end - - def self.up - unless index_exists?(:users, :login, nil) - delete_duplicated_users - add_index :users, :login, :name => 'users_login', :unique => true - end - end - - private - def self.delete_duplicated_users - User.reset_column_information - UserRole.reset_column_information - Property.reset_column_information - GroupsUsers.reset_column_information - Dashboard.reset_column_information - ActiveDashboard.reset_column_information - PermTemplatesUser.reset_column_information - MeasureFilter.reset_column_information - MeasureFilterFavourite.reset_column_information - - say_with_time 'Delete duplicated users' do - existing_logins = Set.new - users=User.find(:all, :select => 'id,login', :order => 'id') - users.each do |user| - if existing_logins.include?(user.login) - say "Delete duplicated login '#{user.login}' (id=#{user.id})" - UserRole.delete_all(['user_id=?', user.id]) - Property.delete_all(['user_id=?', user.id]) - GroupsUsers.delete_all(['user_id=?', user.id]) - Dashboard.destroy_all(['user_id=?', user.id]) - ActiveDashboard.destroy_all(['user_id=?', user.id]) - PermTemplatesUser.destroy_all(['user_id=?', user.id]) - MeasureFilter.destroy_all(['user_id=?', user.id]) - MeasureFilterFavourite.destroy_all(['user_id=?', user.id]) - user.destroy - else - existing_logins.add(user.login) - end - end - end - end - -end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/556_fill_rules_empty_name_and_desc.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/556_fill_rules_empty_name_and_desc.rb deleted file mode 100644 index 28b6f96f852..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/556_fill_rules_empty_name_and_desc.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. -# - -# -# SonarQube 4.4 -# SONAR-5426 -# -class FillRulesEmptyNameAndDesc < ActiveRecord::Migration - - class Rule < ActiveRecord::Base - end - - def self.up - Rule.reset_column_information - - Rule.all(['name IS NULL OR description IS NULL']).each do |rule| - key = rule.plugin_rule_key - unless rule.name - rule.name = key - end - unless rule.description - rule.description = key - end - rule.save! - end - end - -end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/582_update_existing_rules_description_format.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/582_update_existing_rules_description_format.rb deleted file mode 100644 index 4f5fc6be52a..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/582_update_existing_rules_description_format.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. -# - -# -# SonarQube 4.5 -# SONAR-5001 -# -class UpdateExistingRulesDescriptionFormat < ActiveRecord::Migration - - class Rule < ActiveRecord::Base - end - - def self.up - Rule.reset_column_information - Rule.update_all({:description_format => 'HTML', :updated_at => Time.now}, "plugin_name != 'manual' AND template_id IS NULL") - Rule.update_all({:description_format => 'MARKDOWN', :updated_at => Time.now}, "plugin_name = 'manual' OR template_id IS NOT NULL") - end -end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/583_add_missing_rule_parameter_default_values.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/583_add_missing_rule_parameter_default_values.rb deleted file mode 100644 index e8c6f8d70dd..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/583_add_missing_rule_parameter_default_values.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. -# - -# -# SonarQube 4.5 -# -class AddMissingRuleParameterDefaultValues < ActiveRecord::Migration - - def self.up - execute_java_migration 'org.sonar.server.db.migrations.v45.AddMissingRuleParameterDefaultValuesMigrationStep' - end - -end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/584_delete_measures_on_deleted_profiles.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/584_delete_measures_on_deleted_profiles.rb deleted file mode 100644 index 8a075d5fba9..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/584_delete_measures_on_deleted_profiles.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. -# - -# -# SonarQube 4.5 -# -class DeleteMeasuresOnDeletedProfiles < ActiveRecord::Migration - - def self.up - execute_java_migration 'org.sonar.server.db.migrations.v45.DeleteMeasuresOnDeletedProfilesMigrationStep' - end - -end |