From: simonbrandhof Date: Fri, 19 Aug 2011 09:58:27 +0000 (+0200) Subject: Compact database migration scripts created before version 2.1 X-Git-Tag: 2.11^2~137 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=d3d1f85b2f8d5a88c46c71839d45e7cc26a86ff8;p=sonarqube.git Compact database migration scripts created before version 2.1 --- diff --git a/sonar-server/src/main/webapp/WEB-INF/db/migrate/001_initial_schema.rb b/sonar-server/src/main/webapp/WEB-INF/db/migrate/001_initial_schema.rb index 80976a2a65b..5eebd68d994 100644 --- a/sonar-server/src/main/webapp/WEB-INF/db/migrate/001_initial_schema.rb +++ b/sonar-server/src/main/webapp/WEB-INF/db/migrate/001_initial_schema.rb @@ -23,24 +23,46 @@ class InitialSchema < ActiveRecord::Migration t.column :name, :string, :null => true, :limit => 256 t.column :description, :string, :null => true, :limit => 2000 t.column :enabled, :boolean, :null => false, :default => true + t.column 'scope', :string, :limit => 3 + t.column 'qualifier', :string, :limit => 3 + t.column 'kee', :string, :limit => 400 + t.column 'root_id', :integer + t.column :profile_id, :integer, :null => true + t.column :language, :string, :null => true, :limit => 5 + t.column :copy_resource_id, :integer, :null => true + t.column :long_name, :string, :null => true, :limit => 256 end create_table :snapshots do |t| t.column :created_at, :datetime, :null => true, :default => nil - t.column :version, :string, :null => false, :limit => 32 t.column :project_id, :integer, :null => false t.column :parent_snapshot_id, :integer, :null => true t.column :status, :string, :null => false, :default => 'U', :limit => 4 - t.column :purged, :boolean, :null => false, :default => false t.column :islast, :boolean, :null => false, :default => false - + t.column 'scope', :string, :limit => 3 + t.column 'qualifier', :string, :limit => 3 + t.column 'root_snapshot_id', :integer + t.column 'version', :string, :limit => 60, :null => true + t.column :path, :string, :null => true, :limit => 96 + t.column :depth, :integer, :null => true + t.column :root_project_id, :integer, :nullable => true end create_table :metrics do |t| t.column :name, :string, :null => false, :limit => 64 - t.column :value_type, :integer, :null => false t.column :description, :string, :null => true, :limit => 255 t.column :direction, :integer, :null => false, :default => 0 + t.column :domain, :string, :null => true, :limit => 64 + t.column :short_name, :string, :null => true, :limit => 64 + t.column :qualitative, :boolean, :null => false, :default => false + t.column :val_type, :string, :null => true, :limit => 8 + t.column :user_managed, :boolean, :null => true, :default => false + t.column :enabled, :boolean, :null => true, :default => true + t.column :origin, :string, :null => true, :limit => 3 + t.column 'worst_value', :decimal, :null => true, :precision => 30, :scale => 20 + t.column 'best_value', :decimal, :null => true, :precision => 30, :scale => 20 + t.column 'optimized_best_value', :boolean, :null => true + t.column 'hidden', :boolean, :null => true end create_table :project_measures do |t| @@ -49,6 +71,18 @@ class InitialSchema < ActiveRecord::Migration t.column :snapshot_id, :integer, :null => true t.column :rule_id, :integer t.column :rules_category_id, :integer + t.column :text_value, :string, :limit => 96, :null => true + t.column 'tendency', :integer, :null => true + t.column :measure_date, :datetime, :null => true + t.column :project_id, :integer, :null => true + t.column :alert_status, :string, :limit => 5, :null => true + t.column :alert_text, :string, :null => true, :limit => 4000 + t.column :url, :string, :null => true, :limit => 2000 + t.column :description, :string, :null => true, :limit => 4000 + t.column :rule_priority, :integer, :null => true + t.column :diff_value_1, :decimal, :null => true, :precision => 30, :scale => 20 + t.column :diff_value_2, :decimal, :null => true, :precision => 30, :scale => 20 + t.column :diff_value_3, :decimal, :null => true, :precision => 30, :scale => 20 end create_table :rules_categories do |t| @@ -57,12 +91,13 @@ class InitialSchema < ActiveRecord::Migration end create_table :rules do |t| - t.column :name, :string, :null => false, :limit => 128 + t.column :name, :string, :null => false, :limit => 192 t.column :rules_category_id, :integer, :null => false t.column :plugin_rule_key, :string, :null => false, :limit => 200 t.column :plugin_config_key, :string, :null => false, :limit => 200 t.column :plugin_name, :string, :null => false, :limit => 255 t.column :description, :text + t.column :priority, :integer, :null => true end create_table :rule_failures do |t| @@ -70,6 +105,7 @@ class InitialSchema < ActiveRecord::Migration t.column :rule_id, :integer, :null => false t.column :failure_level, :integer, :null => false t.column :message, :string, :limit => 500 + t.column :line, :integer, :null => true end create_table :rules_parameters do |t| diff --git a/sonar-server/src/main/webapp/WEB-INF/db/migrate/002_index_database.rb b/sonar-server/src/main/webapp/WEB-INF/db/migrate/002_index_database.rb index 2e011054f24..bd4a96a58fc 100644 --- a/sonar-server/src/main/webapp/WEB-INF/db/migrate/002_index_database.rb +++ b/sonar-server/src/main/webapp/WEB-INF/db/migrate/002_index_database.rb @@ -27,6 +27,8 @@ class IndexDatabase < ActiveRecord::Migration add_index :rules_parameters, :rule_id, :name => 'rules_parameters_rule_id' add_index :snapshots, :project_id, :name => 'snapshot_project_id' + add_index :snapshots, :parent_snapshot_id, :name => 'snapshots_parent' + add_index :snapshots, :root_snapshot_id, :name => 'snapshots_root' add_index :metrics, :name, :unique => true, :name => 'metrics_unique_name' end diff --git a/sonar-server/src/main/webapp/WEB-INF/db/migrate/013_add_metrics_names.rb b/sonar-server/src/main/webapp/WEB-INF/db/migrate/013_add_metrics_names.rb deleted file mode 100644 index 607f8889cb0..00000000000 --- a/sonar-server/src/main/webapp/WEB-INF/db/migrate/013_add_metrics_names.rb +++ /dev/null @@ -1,28 +0,0 @@ -# -# Sonar, entreprise quality control tool. -# Copyright (C) 2008-2011 SonarSource -# mailto:contact AT sonarsource DOT com -# -# Sonar is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 3 of the License, or (at your option) any later version. -# -# Sonar is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with Sonar; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 -# -class AddMetricsNames < ActiveRecord::Migration - - def self.up - add_column(:metrics, :domain, :string, :null => true, :limit => 64) - add_column(:metrics, :short_name, :string, :null => true, :limit => 64) - add_column(:metrics, :qualitative, :boolean, :null => false, :default => false) - end - -end diff --git a/sonar-server/src/main/webapp/WEB-INF/db/migrate/014_create_rules_profiles.rb b/sonar-server/src/main/webapp/WEB-INF/db/migrate/014_create_rules_profiles.rb index 174a90cecd8..1e4f93feb4c 100644 --- a/sonar-server/src/main/webapp/WEB-INF/db/migrate/014_create_rules_profiles.rb +++ b/sonar-server/src/main/webapp/WEB-INF/db/migrate/014_create_rules_profiles.rb @@ -21,8 +21,10 @@ class CreateRulesProfiles < ActiveRecord::Migration def self.up create_table 'rules_profiles'do |t| - t.column :name, :string, :limit => 40, :null => false - t.column :active, :boolean, :default => false + t.column :name, :string, :limit => 100, :null => false + t.column :default_profile, :boolean, :default => false + t.column :provided, :boolean, :default => false, :null => false + t.column 'language', :string, :limit => 16, :null => true end create_table 'active_rules' do |t| diff --git a/sonar-server/src/main/webapp/WEB-INF/db/migrate/016_add_rules_profiles_provided_column.rb b/sonar-server/src/main/webapp/WEB-INF/db/migrate/016_add_rules_profiles_provided_column.rb deleted file mode 100644 index b5697a1d7dd..00000000000 --- a/sonar-server/src/main/webapp/WEB-INF/db/migrate/016_add_rules_profiles_provided_column.rb +++ /dev/null @@ -1,27 +0,0 @@ -# -# Sonar, entreprise quality control tool. -# Copyright (C) 2008-2011 SonarSource -# mailto:contact AT sonarsource DOT com -# -# Sonar is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 3 of the License, or (at your option) any later version. -# -# Sonar is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with Sonar; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 -# -class AddRulesProfilesProvidedColumn < ActiveRecord::Migration - - def self.up - add_column(:rules_profiles, :provided, :boolean, :default => false, :null => false) - Profile.reset_column_information - end - -end diff --git a/sonar-server/src/main/webapp/WEB-INF/db/migrate/035_create_snapshot_sources.rb b/sonar-server/src/main/webapp/WEB-INF/db/migrate/035_create_snapshot_sources.rb new file mode 100644 index 00000000000..fecb7fab87a --- /dev/null +++ b/sonar-server/src/main/webapp/WEB-INF/db/migrate/035_create_snapshot_sources.rb @@ -0,0 +1,29 @@ +# +# Sonar, entreprise quality control tool. +# Copyright (C) 2008-2011 SonarSource +# mailto:contact AT sonarsource DOT com +# +# Sonar is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# Sonar is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with Sonar; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 +# + +class CreateSnapshotSources < ActiveRecord::Migration + def self.up + create_table :snapshot_sources do |t| + t.column :snapshot_id, :integer, :null => false + t.column :data, :text + end + add_index :snapshot_sources, :snapshot_id, :name => 'snap_sources_snapshot_id' + end +end \ No newline at end of file diff --git a/sonar-server/src/main/webapp/WEB-INF/db/migrate/035_projects_to_entities.rb b/sonar-server/src/main/webapp/WEB-INF/db/migrate/035_projects_to_entities.rb deleted file mode 100644 index 0f249815147..00000000000 --- a/sonar-server/src/main/webapp/WEB-INF/db/migrate/035_projects_to_entities.rb +++ /dev/null @@ -1,81 +0,0 @@ -# -# Sonar, entreprise quality control tool. -# Copyright (C) 2008-2011 SonarSource -# mailto:contact AT sonarsource DOT com -# -# Sonar is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 3 of the License, or (at your option) any later version. -# -# Sonar is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with Sonar; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 -# - -require 'project' - -class Project - def branch - read_attribute(:branch) - end -end - -class ProjectsToEntities < ActiveRecord::Migration - def self.up - add_column 'projects', 'scope', :string, :limit => 3 - add_column 'projects', 'qualifier', :string, :limit => 3 - add_column 'projects', 'kee', :string, :limit => 230 - add_column 'projects', 'root_id', :integer - - Project.reset_column_information - - upgrade_snapshots - move_file_sources_to_snapshot_sources - - migrate_distribution_data - end - - private - - def self.migrate_distribution_data - add_column :project_measures, :text_value, :string, :limit => 96, :null => true - ProjectMeasure.reset_column_information - end - - def self.upgrade_snapshots - add_column 'snapshots', 'scope', :string, :limit => 3 - add_column 'snapshots', 'qualifier', :string, :limit => 3 - add_column 'snapshots', 'root_snapshot_id', :integer - - remove_column 'snapshots', 'version' - add_column 'snapshots', 'version', :string, :limit => 32 - - Snapshot.reset_column_information - - begin - remove_index :snapshots, :name => 'snapshot_created_at' - rescue - # the index does not exist (from 1.3) - end - add_index :snapshots, :parent_snapshot_id, :name => 'snapshots_parent' - add_index :snapshots, :root_snapshot_id, :name => 'snapshots_root' - end - - def self.move_file_sources_to_snapshot_sources - create_table :snapshot_sources do |t| - t.column :snapshot_id, :integer, :null => false - t.column :data, :text - end - add_index :snapshot_sources, :snapshot_id, :name => 'snap_sources_snapshot_id' - end - - class RuleFailure035 < ActiveRecord::Base - set_table_name "rule_failures" - end -end \ No newline at end of file diff --git a/sonar-server/src/main/webapp/WEB-INF/db/migrate/036_add_measure_tendency.rb b/sonar-server/src/main/webapp/WEB-INF/db/migrate/036_add_measure_tendency.rb deleted file mode 100644 index 84c5df8cf08..00000000000 --- a/sonar-server/src/main/webapp/WEB-INF/db/migrate/036_add_measure_tendency.rb +++ /dev/null @@ -1,26 +0,0 @@ -# -# Sonar, entreprise quality control tool. -# Copyright (C) 2008-2011 SonarSource -# mailto:contact AT sonarsource DOT com -# -# Sonar is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 3 of the License, or (at your option) any later version. -# -# Sonar is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with Sonar; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 -# -class AddMeasureTendency < ActiveRecord::Migration - def self.up - add_column 'project_measures', 'tendency', :integer, :null => true - ProjectMeasure.reset_column_information - end - -end \ No newline at end of file diff --git a/sonar-server/src/main/webapp/WEB-INF/db/migrate/039_add_rules_profiles_language.rb b/sonar-server/src/main/webapp/WEB-INF/db/migrate/039_add_rules_profiles_language.rb deleted file mode 100644 index 76f0cf9a21d..00000000000 --- a/sonar-server/src/main/webapp/WEB-INF/db/migrate/039_add_rules_profiles_language.rb +++ /dev/null @@ -1,26 +0,0 @@ -# -# Sonar, entreprise quality control tool. -# Copyright (C) 2008-2011 SonarSource -# mailto:contact AT sonarsource DOT com -# -# Sonar is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 3 of the License, or (at your option) any later version. -# -# Sonar is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with Sonar; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 -# -class AddRulesProfilesLanguage < ActiveRecord::Migration - - def self.up - add_column 'rules_profiles', 'language', :string, :limit => 16, :null => true - Profile.reset_column_information - end -end diff --git a/sonar-server/src/main/webapp/WEB-INF/db/migrate/041_increase_rules_name_size.rb b/sonar-server/src/main/webapp/WEB-INF/db/migrate/041_increase_rules_name_size.rb deleted file mode 100644 index e48f6f6e948..00000000000 --- a/sonar-server/src/main/webapp/WEB-INF/db/migrate/041_increase_rules_name_size.rb +++ /dev/null @@ -1,26 +0,0 @@ -# -# Sonar, entreprise quality control tool. -# Copyright (C) 2008-2011 SonarSource -# mailto:contact AT sonarsource DOT com -# -# Sonar is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 3 of the License, or (at your option) any later version. -# -# Sonar is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with Sonar; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 -# -class IncreaseRulesNameSize < ActiveRecord::Migration - - def self.up - change_column('rules', 'name', :string, :limit => 192) - end - -end diff --git a/sonar-server/src/main/webapp/WEB-INF/db/migrate/046_simplify_metrics.rb b/sonar-server/src/main/webapp/WEB-INF/db/migrate/046_simplify_metrics.rb deleted file mode 100644 index 64fd7c37eb3..00000000000 --- a/sonar-server/src/main/webapp/WEB-INF/db/migrate/046_simplify_metrics.rb +++ /dev/null @@ -1,31 +0,0 @@ -# -# Sonar, entreprise quality control tool. -# Copyright (C) 2008-2011 SonarSource -# mailto:contact AT sonarsource DOT com -# -# Sonar is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 3 of the License, or (at your option) any later version. -# -# Sonar is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with Sonar; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 -# -class SimplifyMetrics < ActiveRecord::Migration - - def self.up - add_column(:metrics, :val_type, :string, :null => true, :limit => 8) - add_column(:metrics, :user_managed, :boolean, :null => true, :default => false) - add_column(:metrics, :enabled, :boolean, :null => true, :default => true) - - remove_column(:metrics, :value_type) - - Metric.reset_column_information - end -end diff --git a/sonar-server/src/main/webapp/WEB-INF/db/migrate/049_remove_external_measures_table.rb b/sonar-server/src/main/webapp/WEB-INF/db/migrate/049_remove_external_measures_table.rb deleted file mode 100644 index 88121955ce2..00000000000 --- a/sonar-server/src/main/webapp/WEB-INF/db/migrate/049_remove_external_measures_table.rb +++ /dev/null @@ -1,40 +0,0 @@ -# -# Sonar, entreprise quality control tool. -# Copyright (C) 2008-2011 SonarSource -# mailto:contact AT sonarsource DOT com -# -# Sonar is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 3 of the License, or (at your option) any later version. -# -# Sonar is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with Sonar; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 -# -class RemoveExternalMeasuresTable < ActiveRecord::Migration - - def self.up - add_columns_to_project_measures - end - - def self.down - - end - - - private - - def self.add_columns_to_project_measures - add_column(:project_measures, :measure_date, :datetime, :null => true) - add_column(:project_measures, :project_id, :integer, :null => true) - change_column(:project_measures, :snapshot_id, :integer, :null => true) - ProjectMeasure.reset_column_information - end - -end diff --git a/sonar-server/src/main/webapp/WEB-INF/db/migrate/051_add_metrics_origin_column.rb b/sonar-server/src/main/webapp/WEB-INF/db/migrate/051_add_metrics_origin_column.rb deleted file mode 100644 index 36f1d2c2954..00000000000 --- a/sonar-server/src/main/webapp/WEB-INF/db/migrate/051_add_metrics_origin_column.rb +++ /dev/null @@ -1,27 +0,0 @@ -# -# Sonar, entreprise quality control tool. -# Copyright (C) 2008-2011 SonarSource -# mailto:contact AT sonarsource DOT com -# -# Sonar is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 3 of the License, or (at your option) any later version. -# -# Sonar is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with Sonar; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 -# -class AddMetricsOriginColumn < ActiveRecord::Migration - - def self.up - add_column(:metrics, :origin, :string, :null => true, :limit => 3) - Metric.reset_column_information - end - -end diff --git a/sonar-server/src/main/webapp/WEB-INF/db/migrate/054_create_alerts_table.rb b/sonar-server/src/main/webapp/WEB-INF/db/migrate/054_create_alerts_table.rb index a03d052cc77..3bf06e3bb1f 100644 --- a/sonar-server/src/main/webapp/WEB-INF/db/migrate/054_create_alerts_table.rb +++ b/sonar-server/src/main/webapp/WEB-INF/db/migrate/054_create_alerts_table.rb @@ -27,9 +27,6 @@ class CreateAlertsTable < ActiveRecord::Migration t.column :value_error, :string, :limit => 64, :null => true t.column :value_warning, :string, :limit => 64, :null => true end - - add_column :project_measures, :alert_status, :string, :limit => 5, :null => true - end end diff --git a/sonar-server/src/main/webapp/WEB-INF/db/migrate/055_create_profiles_per_project.rb b/sonar-server/src/main/webapp/WEB-INF/db/migrate/055_create_profiles_per_project.rb deleted file mode 100644 index ce8a605bd48..00000000000 --- a/sonar-server/src/main/webapp/WEB-INF/db/migrate/055_create_profiles_per_project.rb +++ /dev/null @@ -1,29 +0,0 @@ -# -# Sonar, open source software quality management tool. -# Copyright (C) 2008-2011 SonarSource -# mailto:contact AT sonarsource DOT com -# -# Sonar is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 3 of the License, or (at your option) any later version. -# -# Sonar is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with Sonar; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 -# -class CreateProfilesPerProject < ActiveRecord::Migration - - def self.up - add_column :projects, :profile_id, :integer, :null => true - Project.reset_column_information - rename_column :rules_profiles, :active, :default_profile - Profile.reset_column_information - end - -end \ No newline at end of file diff --git a/sonar-server/src/main/webapp/WEB-INF/db/migrate/057_ensure_measure_snapshot_column_null.rb b/sonar-server/src/main/webapp/WEB-INF/db/migrate/057_ensure_measure_snapshot_column_null.rb deleted file mode 100644 index b63aef33688..00000000000 --- a/sonar-server/src/main/webapp/WEB-INF/db/migrate/057_ensure_measure_snapshot_column_null.rb +++ /dev/null @@ -1,37 +0,0 @@ -# -# Sonar, open source software quality management tool. -# Copyright (C) 2008-2011 SonarSource -# mailto:contact AT sonarsource DOT com -# -# Sonar is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 3 of the License, or (at your option) any later version. -# -# Sonar is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with Sonar; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 -# -class EnsureMeasureSnapshotColumnNull < ActiveRecord::Migration - - def self.up - # due to a migration issue under oracle with previous version, we have to make sure that this colum - # is set to null even if already done in migration 49 - begin - change_column(:project_measures, :snapshot_id, :integer, :null => true) - rescue - puts "project_measures.snapshot_id already set to nullable" - end - - end - - def self.down - - end - -end \ No newline at end of file diff --git a/sonar-server/src/main/webapp/WEB-INF/db/migrate/058_add_snapshots_path.rb b/sonar-server/src/main/webapp/WEB-INF/db/migrate/058_add_snapshots_path.rb deleted file mode 100644 index 4307aa28eb3..00000000000 --- a/sonar-server/src/main/webapp/WEB-INF/db/migrate/058_add_snapshots_path.rb +++ /dev/null @@ -1,32 +0,0 @@ -# -# Sonar, open source software quality management tool. -# Copyright (C) 2008-2011 SonarSource -# mailto:contact AT sonarsource DOT com -# -# Sonar is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 3 of the License, or (at your option) any later version. -# -# Sonar is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with Sonar; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 -# -class AddSnapshotsPath < ActiveRecord::Migration - - def self.up - add_column(:snapshots, :path, :string, :null => true, :limit => 96) - add_column(:snapshots, :depth, :integer, :null => true) - Snapshot.reset_column_information - end - - def self.down - - end - -end \ No newline at end of file diff --git a/sonar-server/src/main/webapp/WEB-INF/db/migrate/059_add_properties_resource.rb b/sonar-server/src/main/webapp/WEB-INF/db/migrate/059_add_properties_resource.rb deleted file mode 100644 index c724469946c..00000000000 --- a/sonar-server/src/main/webapp/WEB-INF/db/migrate/059_add_properties_resource.rb +++ /dev/null @@ -1,31 +0,0 @@ -# -# Sonar, open source software quality management tool. -# Copyright (C) 2008-2011 SonarSource -# mailto:contact AT sonarsource DOT com -# -# Sonar is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 3 of the License, or (at your option) any later version. -# -# Sonar is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with Sonar; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 -# -class AddPropertiesResource < ActiveRecord::Migration - - def self.up - create_table 'properties' do |t| - t.column :prop_key, :string, :limit => 512 - t.column :resource_id, :integer, :null => true - t.column :prop_value, :string, :limit => 4000 - end - add_index :properties, :prop_key, :name => 'properties_key' - end - -end diff --git a/sonar-server/src/main/webapp/WEB-INF/db/migrate/059_create_properties.rb b/sonar-server/src/main/webapp/WEB-INF/db/migrate/059_create_properties.rb new file mode 100644 index 00000000000..d0b33566669 --- /dev/null +++ b/sonar-server/src/main/webapp/WEB-INF/db/migrate/059_create_properties.rb @@ -0,0 +1,31 @@ +# +# Sonar, open source software quality management tool. +# Copyright (C) 2008-2011 SonarSource +# mailto:contact AT sonarsource DOT com +# +# Sonar is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# Sonar is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with Sonar; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 +# +class CreateProperties < ActiveRecord::Migration + + def self.up + create_table 'properties' do |t| + t.column :prop_key, :string, :limit => 512 + t.column :resource_id, :integer, :null => true + t.column :text_value, :text, :null => true + end + add_index :properties, :prop_key, :name => 'properties_key' + end + +end diff --git a/sonar-server/src/main/webapp/WEB-INF/db/migrate/060_add_project_language.rb b/sonar-server/src/main/webapp/WEB-INF/db/migrate/060_add_project_language.rb deleted file mode 100644 index 2b110b22761..00000000000 --- a/sonar-server/src/main/webapp/WEB-INF/db/migrate/060_add_project_language.rb +++ /dev/null @@ -1,27 +0,0 @@ -# -# Sonar, open source software quality management tool. -# Copyright (C) 2008-2011 SonarSource -# mailto:contact AT sonarsource DOT com -# -# Sonar is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 3 of the License, or (at your option) any later version. -# -# Sonar is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with Sonar; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 -# -class AddProjectLanguage < ActiveRecord::Migration - - def self.up - add_column(:projects, :language, :string, :null => true, :limit => 5) - Project.reset_column_information - end - -end diff --git a/sonar-server/src/main/webapp/WEB-INF/db/migrate/061_add_measure_data.rb b/sonar-server/src/main/webapp/WEB-INF/db/migrate/061_add_measure_data.rb index a2b6a43c807..0b3d43418fb 100644 --- a/sonar-server/src/main/webapp/WEB-INF/db/migrate/061_add_measure_data.rb +++ b/sonar-server/src/main/webapp/WEB-INF/db/migrate/061_add_measure_data.rb @@ -26,20 +26,11 @@ class AddMeasureData < ActiveRecord::Migration t.column :data, :binary, :null => true end add_index :measure_data, :measure_id, :name => 'measure_data_measure_id' - MeasureData061.reset_column_information - - add_column(:project_measures, :alert_text, :string, :null => true, :limit => 4000) - add_column(:project_measures, :url, :string, :null => true, :limit => 2000) - add_column(:project_measures, :description, :string, :null => true, :limit => 4000) - ProjectMeasure.reset_column_information + MeasureData061.reset_column_information end class MeasureData061 < ActiveRecord::Base set_table_name :measure_data end - class ProjectMeasure61 < ActiveRecord::Base - set_table_name :project_measures - end - end \ No newline at end of file diff --git a/sonar-server/src/main/webapp/WEB-INF/db/migrate/066_increase_size_of_rules_profiles_name.rb b/sonar-server/src/main/webapp/WEB-INF/db/migrate/066_increase_size_of_rules_profiles_name.rb deleted file mode 100644 index 14205a37b86..00000000000 --- a/sonar-server/src/main/webapp/WEB-INF/db/migrate/066_increase_size_of_rules_profiles_name.rb +++ /dev/null @@ -1,26 +0,0 @@ - # - # Sonar, entreprise quality control tool. - # Copyright (C) 2008-2011 SonarSource - # mailto:contact AT sonarsource DOT com - # - # Sonar is free software; you can redistribute it and/or - # modify it under the terms of the GNU Lesser General Public - # License as published by the Free Software Foundation; either - # version 3 of the License, or (at your option) any later version. - # - # Sonar is distributed in the hope that it will be useful, - # but WITHOUT ANY WARRANTY; without even the implied warranty of - # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - # Lesser General Public License for more details. - # - # You should have received a copy of the GNU Lesser General Public - # License along with Sonar; if not, write to the Free Software - # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 - # -class IncreaseSizeOfRulesProfilesName < ActiveRecord::Migration - - def self.up - change_column('rules_profiles', 'name', :string, :limit => 100) - end - -end \ No newline at end of file diff --git a/sonar-server/src/main/webapp/WEB-INF/db/migrate/068_add_rule_priority.rb b/sonar-server/src/main/webapp/WEB-INF/db/migrate/068_add_rule_priority.rb deleted file mode 100644 index e53aadd92a0..00000000000 --- a/sonar-server/src/main/webapp/WEB-INF/db/migrate/068_add_rule_priority.rb +++ /dev/null @@ -1,50 +0,0 @@ -# -# Sonar, entreprise quality control tool. -# Copyright (C) 2008-2011 SonarSource -# mailto:contact AT sonarsource DOT com -# -# Sonar is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 3 of the License, or (at your option) any later version. -# -# Sonar is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with Sonar; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 -# -class AddRulePriority < ActiveRecord::Migration - - def self.up - add_column(:rules, :priority, :integer, :null => true) - Rule.reset_column_information - - add_column(:project_measures, :rule_priority, :integer, :null => true) - ProjectMeasure.reset_column_information - - violations = Metric.find(:first, :conditions => {:name => Metric::VIOLATIONS}) - - mandatory_violations_density = Metric.find(:first, :conditions => {:name => 'mandatory_violations_density'}) - ProjectMeasure.delete_all("metric_id=" + mandatory_violations_density.id.to_s) if mandatory_violations_density - - mandatory_violations = Metric.find(:first, :conditions => {:name => 'mandatory_violations'}) - if mandatory_violations and violations - ProjectMeasure.update_all("rule_priority=" + Sonar::RulePriority::PRIORITY_MAJOR.to_s, "metric_id=" + mandatory_violations.id.to_s) - ProjectMeasure.update_all("metric_id=" + violations.id.to_s, "metric_id=" + mandatory_violations.id.to_s) - end - - optional_violations = Metric.find(:first, :conditions => {:name => 'optional_violations'}) - if optional_violations and violations - ProjectMeasure.update_all("rule_priority=" + Sonar::RulePriority::PRIORITY_INFO.to_s, "metric_id=" + optional_violations.id.to_s) - ProjectMeasure.update_all("metric_id=" + violations.id.to_s, "metric_id=" + optional_violations.id.to_s) - end - - #SONAR-1062 Active rules with optional level are not converted to priority INFO during 1.10 migration - ActiveRule.update_all('failure_level=0', 'failure_level=1') - end - -end \ No newline at end of file diff --git a/sonar-server/src/main/webapp/WEB-INF/db/migrate/069_add_diff_columns_to_measures.rb b/sonar-server/src/main/webapp/WEB-INF/db/migrate/069_add_diff_columns_to_measures.rb deleted file mode 100644 index cfacedc0dc2..00000000000 --- a/sonar-server/src/main/webapp/WEB-INF/db/migrate/069_add_diff_columns_to_measures.rb +++ /dev/null @@ -1,28 +0,0 @@ -# -# Sonar, entreprise quality control tool. -# Copyright (C) 2008-2011 SonarSource -# mailto:contact AT sonarsource DOT com -# -# Sonar is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 3 of the License, or (at your option) any later version. -# -# Sonar is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with Sonar; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 -# -class AddDiffColumnsToMeasures < ActiveRecord::Migration - - def self.up - add_column(:project_measures, :diff_value_1, :decimal, :null => true, :precision => 30, :scale => 20) - add_column(:project_measures, :diff_value_2, :decimal, :null => true, :precision => 30, :scale => 20) - add_column(:project_measures, :diff_value_3, :decimal, :null => true, :precision => 30, :scale => 20) - end - -end \ No newline at end of file diff --git a/sonar-server/src/main/webapp/WEB-INF/db/migrate/072_delete_snapshots_purged.rb b/sonar-server/src/main/webapp/WEB-INF/db/migrate/072_delete_snapshots_purged.rb deleted file mode 100644 index 91111464251..00000000000 --- a/sonar-server/src/main/webapp/WEB-INF/db/migrate/072_delete_snapshots_purged.rb +++ /dev/null @@ -1,26 +0,0 @@ - # - # Sonar, entreprise quality control tool. - # Copyright (C) 2008-2011 SonarSource - # mailto:contact AT sonarsource DOT com - # - # Sonar is free software; you can redistribute it and/or - # modify it under the terms of the GNU Lesser General Public - # License as published by the Free Software Foundation; either - # version 3 of the License, or (at your option) any later version. - # - # Sonar is distributed in the hope that it will be useful, - # but WITHOUT ANY WARRANTY; without even the implied warranty of - # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - # Lesser General Public License for more details. - # - # You should have received a copy of the GNU Lesser General Public - # License along with Sonar; if not, write to the Free Software - # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 - # -class DeleteSnapshotsPurged < ActiveRecord::Migration - - def self.up - remove_column(:snapshots, :purged) - Snapshot.reset_column_information - end -end \ No newline at end of file diff --git a/sonar-server/src/main/webapp/WEB-INF/db/migrate/073_add_line_to_rule_failures.rb b/sonar-server/src/main/webapp/WEB-INF/db/migrate/073_add_line_to_rule_failures.rb deleted file mode 100644 index 70b189784ca..00000000000 --- a/sonar-server/src/main/webapp/WEB-INF/db/migrate/073_add_line_to_rule_failures.rb +++ /dev/null @@ -1,27 +0,0 @@ - # - # Sonar, entreprise quality control tool. - # Copyright (C) 2008-2011 SonarSource - # mailto:contact AT sonarsource DOT com - # - # Sonar is free software; you can redistribute it and/or - # modify it under the terms of the GNU Lesser General Public - # License as published by the Free Software Foundation; either - # version 3 of the License, or (at your option) any later version. - # - # Sonar is distributed in the hope that it will be useful, - # but WITHOUT ANY WARRANTY; without even the implied warranty of - # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - # Lesser General Public License for more details. - # - # You should have received a copy of the GNU Lesser General Public - # License along with Sonar; if not, write to the Free Software - # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 - # -class AddLineToRuleFailures < ActiveRecord::Migration - - def self.up - add_column :rule_failures, :line, :integer, :null => true - RuleFailure.reset_column_information - end - -end \ No newline at end of file diff --git a/sonar-server/src/main/webapp/WEB-INF/db/migrate/075_reset_tendency_depth.rb b/sonar-server/src/main/webapp/WEB-INF/db/migrate/075_reset_tendency_depth.rb deleted file mode 100644 index ba00735f89e..00000000000 --- a/sonar-server/src/main/webapp/WEB-INF/db/migrate/075_reset_tendency_depth.rb +++ /dev/null @@ -1,29 +0,0 @@ - # - # Sonar, entreprise quality control tool. - # Copyright (C) 2008-2011 SonarSource - # mailto:contact AT sonarsource DOT com - # - # Sonar is free software; you can redistribute it and/or - # modify it under the terms of the GNU Lesser General Public - # License as published by the Free Software Foundation; either - # version 3 of the License, or (at your option) any later version. - # - # Sonar is distributed in the hope that it will be useful, - # but WITHOUT ANY WARRANTY; without even the implied warranty of - # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - # Lesser General Public License for more details. - # - # You should have received a copy of the GNU Lesser General Public - # License along with Sonar; if not, write to the Free Software - # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 - # -class ResetTendencyDepth < ActiveRecord::Migration - - def self.up - begin - Property.delete_all("prop_key='tendency.depth'") - rescue - end - end - -end \ No newline at end of file diff --git a/sonar-server/src/main/webapp/WEB-INF/db/migrate/076_upgrade_properties_to_blobs.rb b/sonar-server/src/main/webapp/WEB-INF/db/migrate/076_upgrade_properties_to_blobs.rb deleted file mode 100644 index cc361ccfcd4..00000000000 --- a/sonar-server/src/main/webapp/WEB-INF/db/migrate/076_upgrade_properties_to_blobs.rb +++ /dev/null @@ -1,35 +0,0 @@ - # - # Sonar, entreprise quality control tool. - # Copyright (C) 2008-2011 SonarSource - # mailto:contact AT sonarsource DOT com - # - # Sonar is free software; you can redistribute it and/or - # modify it under the terms of the GNU Lesser General Public - # License as published by the Free Software Foundation; either - # version 3 of the License, or (at your option) any later version. - # - # Sonar is distributed in the hope that it will be useful, - # but WITHOUT ANY WARRANTY; without even the implied warranty of - # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - # Lesser General Public License for more details. - # - # You should have received a copy of the GNU Lesser General Public - # License along with Sonar; if not, write to the Free Software - # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 - # -class UpgradePropertiesToBlobs < ActiveRecord::Migration - - def self.up - add_column(:properties, :text_value, :text, :null => true) - Property.reset_column_information - - Property.find(:all).each do |p| - p.text_value=p.prop_value - p.save! - end - - remove_column(:properties, :prop_value) - Property.reset_column_information - end - -end \ No newline at end of file diff --git a/sonar-server/src/main/webapp/WEB-INF/db/migrate/077_add_copy_resource_id_to_projects.rb b/sonar-server/src/main/webapp/WEB-INF/db/migrate/077_add_copy_resource_id_to_projects.rb deleted file mode 100644 index 303920a64ae..00000000000 --- a/sonar-server/src/main/webapp/WEB-INF/db/migrate/077_add_copy_resource_id_to_projects.rb +++ /dev/null @@ -1,26 +0,0 @@ - # - # Sonar, entreprise quality control tool. - # Copyright (C) 2008-2011 SonarSource - # mailto:contact AT sonarsource DOT com - # - # Sonar is free software; you can redistribute it and/or - # modify it under the terms of the GNU Lesser General Public - # License as published by the Free Software Foundation; either - # version 3 of the License, or (at your option) any later version. - # - # Sonar is distributed in the hope that it will be useful, - # but WITHOUT ANY WARRANTY; without even the implied warranty of - # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - # Lesser General Public License for more details. - # - # You should have received a copy of the GNU Lesser General Public - # License along with Sonar; if not, write to the Free Software - # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 - # -class AddCopyResourceIdToProjects < ActiveRecord::Migration - - def self.up - add_column(:projects, :copy_resource_id, :integer, :null => true) - end - -end \ No newline at end of file diff --git a/sonar-server/src/main/webapp/WEB-INF/db/migrate/078_increase_project_kee_size.rb b/sonar-server/src/main/webapp/WEB-INF/db/migrate/078_increase_project_kee_size.rb deleted file mode 100644 index 074dd969836..00000000000 --- a/sonar-server/src/main/webapp/WEB-INF/db/migrate/078_increase_project_kee_size.rb +++ /dev/null @@ -1,26 +0,0 @@ - # - # Sonar, entreprise quality control tool. - # Copyright (C) 2008-2011 SonarSource - # mailto:contact AT sonarsource DOT com - # - # Sonar is free software; you can redistribute it and/or - # modify it under the terms of the GNU Lesser General Public - # License as published by the Free Software Foundation; either - # version 3 of the License, or (at your option) any later version. - # - # Sonar is distributed in the hope that it will be useful, - # but WITHOUT ANY WARRANTY; without even the implied warranty of - # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - # Lesser General Public License for more details. - # - # You should have received a copy of the GNU Lesser General Public - # License along with Sonar; if not, write to the Free Software - # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 - # -class IncreaseProjectKeeSize < ActiveRecord::Migration - - def self.up - change_column('projects', 'kee', :string, :limit => 400) - end - -end \ No newline at end of file diff --git a/sonar-server/src/main/webapp/WEB-INF/db/migrate/081_add_projects_long_name.rb b/sonar-server/src/main/webapp/WEB-INF/db/migrate/081_add_projects_long_name.rb deleted file mode 100644 index bb8758ceeab..00000000000 --- a/sonar-server/src/main/webapp/WEB-INF/db/migrate/081_add_projects_long_name.rb +++ /dev/null @@ -1,27 +0,0 @@ - # - # Sonar, entreprise quality control tool. - # Copyright (C) 2008-2011 SonarSource - # mailto:contact AT sonarsource DOT com - # - # Sonar is free software; you can redistribute it and/or - # modify it under the terms of the GNU Lesser General Public - # License as published by the Free Software Foundation; either - # version 3 of the License, or (at your option) any later version. - # - # Sonar is distributed in the hope that it will be useful, - # but WITHOUT ANY WARRANTY; without even the implied warranty of - # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - # Lesser General Public License for more details. - # - # You should have received a copy of the GNU Lesser General Public - # License along with Sonar; if not, write to the Free Software - # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 - # -class AddProjectsLongName < ActiveRecord::Migration - - def self.up - add_column :projects, :long_name, :string, :null => true, :limit => 256 - Project.reset_column_information - end - -end \ No newline at end of file diff --git a/sonar-server/src/main/webapp/WEB-INF/db/migrate/082_include_branch_in_project_name.rb b/sonar-server/src/main/webapp/WEB-INF/db/migrate/082_include_branch_in_project_name.rb deleted file mode 100644 index 6b36ffd5ecc..00000000000 --- a/sonar-server/src/main/webapp/WEB-INF/db/migrate/082_include_branch_in_project_name.rb +++ /dev/null @@ -1,40 +0,0 @@ - # - # Sonar, entreprise quality control tool. - # Copyright (C) 2008-2011 SonarSource - # mailto:contact AT sonarsource DOT com - # - # Sonar is free software; you can redistribute it and/or - # modify it under the terms of the GNU Lesser General Public - # License as published by the Free Software Foundation; either - # version 3 of the License, or (at your option) any later version. - # - # Sonar is distributed in the hope that it will be useful, - # but WITHOUT ANY WARRANTY; without even the implied warranty of - # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - # Lesser General Public License for more details. - # - # You should have received a copy of the GNU Lesser General Public - # License along with Sonar; if not, write to the Free Software - # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 - # -class IncludeBranchInProjectName < ActiveRecord::Migration - - def self.up - Project.find(:all, :conditions => {:scope => Project::SCOPE_SET, :qualifier => Project::QUALIFIER_PROJECT}).each do |project| - branch=branch(project) - if branch - project.name+= ' ' + branch - project.save! - end - end - end - - private - def self.branch(project) - s=project.kee.split(':') - if s.size>=3 - return s[2] - end - nil - end -end \ No newline at end of file diff --git a/sonar-server/src/main/webapp/WEB-INF/db/migrate/084_delete_some_findbugs_rules.rb b/sonar-server/src/main/webapp/WEB-INF/db/migrate/084_delete_some_findbugs_rules.rb deleted file mode 100644 index a4a97eba046..00000000000 --- a/sonar-server/src/main/webapp/WEB-INF/db/migrate/084_delete_some_findbugs_rules.rb +++ /dev/null @@ -1,38 +0,0 @@ - # - # Sonar, entreprise quality control tool. - # Copyright (C) 2008-2011 SonarSource - # mailto:contact AT sonarsource DOT com - # - # Sonar is free software; you can redistribute it and/or - # modify it under the terms of the GNU Lesser General Public - # License as published by the Free Software Foundation; either - # version 3 of the License, or (at your option) any later version. - # - # Sonar is distributed in the hope that it will be useful, - # but WITHOUT ANY WARRANTY; without even the implied warranty of - # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - # Lesser General Public License for more details. - # - # You should have received a copy of the GNU Lesser General Public - # License along with Sonar; if not, write to the Free Software - # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 - # -class DeleteSomeFindbugsRules < ActiveRecord::Migration - - def self.up - delete_rule('EQ_DOESNT_OVERRIDE_EQUALS') - delete_rule('OBL_UNSATISFIED_OBLIGATION') - end - - private - def self.delete_rule(rule_key) - rule=Rule.find(:first, :conditions => {:plugin_name => 'findbugs', :plugin_rule_key => rule_key}) - if rule - say_with_time "Deleting Findbugs rule #{rule_key}..." do - rule_id=rule.id - ActiveRule.delete_all(["rule_id=?", rule_id]) - rule.delete - end - end - end -end \ No newline at end of file diff --git a/sonar-server/src/main/webapp/WEB-INF/db/migrate/085_add_metric_value_limits.rb b/sonar-server/src/main/webapp/WEB-INF/db/migrate/085_add_metric_value_limits.rb deleted file mode 100644 index 62760eb619e..00000000000 --- a/sonar-server/src/main/webapp/WEB-INF/db/migrate/085_add_metric_value_limits.rb +++ /dev/null @@ -1,35 +0,0 @@ - # - # Sonar, entreprise quality control tool. - # Copyright (C) 2008-2011 SonarSource - # mailto:contact AT sonarsource DOT com - # - # Sonar is free software; you can redistribute it and/or - # modify it under the terms of the GNU Lesser General Public - # License as published by the Free Software Foundation; either - # version 3 of the License, or (at your option) any later version. - # - # Sonar is distributed in the hope that it will be useful, - # but WITHOUT ANY WARRANTY; without even the implied warranty of - # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - # Lesser General Public License for more details. - # - # You should have received a copy of the GNU Lesser General Public - # License along with Sonar; if not, write to the Free Software - # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 - # - -# see SONAR-1075 -class AddMetricValueLimits < ActiveRecord::Migration - - def self.up - add_column 'metrics', 'worst_value', :decimal, :null => true, :precision => 30, :scale => 20 - add_column 'metrics', 'best_value', :decimal, :null => true, :precision => 30, :scale => 20 - add_column 'metrics', 'optimized_best_value', :boolean, :null => true - end - - def self.down - remove_column 'metrics', 'worst_value' - remove_column 'metrics', 'best_value' - remove_column 'metrics', 'optimized_best_value' - end -end \ No newline at end of file diff --git a/sonar-server/src/main/webapp/WEB-INF/db/migrate/090_add_name_to_users.rb b/sonar-server/src/main/webapp/WEB-INF/db/migrate/090_add_name_to_users.rb index e8076d80ab3..915b172192c 100644 --- a/sonar-server/src/main/webapp/WEB-INF/db/migrate/090_add_name_to_users.rb +++ b/sonar-server/src/main/webapp/WEB-INF/db/migrate/090_add_name_to_users.rb @@ -32,8 +32,4 @@ class AddNameToUsers < ActiveRecord::Migration end - def self.down - - end - end diff --git a/sonar-server/src/main/webapp/WEB-INF/db/migrate/091_add_root_project_id_to_snapshots.rb b/sonar-server/src/main/webapp/WEB-INF/db/migrate/091_add_root_project_id_to_snapshots.rb deleted file mode 100644 index a667100b95e..00000000000 --- a/sonar-server/src/main/webapp/WEB-INF/db/migrate/091_add_root_project_id_to_snapshots.rb +++ /dev/null @@ -1,31 +0,0 @@ -# -# Sonar, entreprise quality control tool. -# Copyright (C) 2008-2011 SonarSource -# mailto:contact AT sonarsource DOT com -# -# Sonar is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 3 of the License, or (at your option) any later version. -# -# Sonar is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with Sonar; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 -# -class AddRootProjectIdToSnapshots < ActiveRecord::Migration - - def self.up - add_column(:snapshots, :root_project_id, :integer, :nullable => true) - Snapshot.reset_column_information - end - - def self.down - - end - -end diff --git a/sonar-server/src/main/webapp/WEB-INF/db/migrate/092_fill_snapshots_root_project_id.rb b/sonar-server/src/main/webapp/WEB-INF/db/migrate/092_fill_snapshots_root_project_id.rb deleted file mode 100644 index 351cf6f0789..00000000000 --- a/sonar-server/src/main/webapp/WEB-INF/db/migrate/092_fill_snapshots_root_project_id.rb +++ /dev/null @@ -1,42 +0,0 @@ -# -# Sonar, entreprise quality control tool. -# Copyright (C) 2008-2011 SonarSource -# mailto:contact AT sonarsource DOT com -# -# Sonar is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 3 of the License, or (at your option) any later version. -# -# Sonar is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with Sonar; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 -# -class FillSnapshotsRootProjectId < ActiveRecord::Migration - - def self.up - snapshots=Snapshot.find(:all, :select => 'id,root_snapshot_id', :conditions => ['islast=?', true]) - root_sids=[] - snapshots.each do |s| - root_sids<< (s.root_snapshot_id || s.id) - end - root_sids=root_sids.uniq.compact - - root_sids.each do |root_sid| - root_snapshot=Snapshot.find(:first, :conditions => {:id => root_sid}) - if root_snapshot - Snapshot.update_all("root_project_id=#{root_snapshot.project_id}", ['root_snapshot_id=? or id=?', root_sid, root_sid]) - end - end - end - - def self.down - - end - -end diff --git a/sonar-server/src/main/webapp/WEB-INF/db/migrate/093_create_dependencies_table.rb b/sonar-server/src/main/webapp/WEB-INF/db/migrate/093_create_dependencies_table.rb index 7b90fb7f035..650d69ee8c8 100644 --- a/sonar-server/src/main/webapp/WEB-INF/db/migrate/093_create_dependencies_table.rb +++ b/sonar-server/src/main/webapp/WEB-INF/db/migrate/093_create_dependencies_table.rb @@ -25,7 +25,7 @@ class CreateDependenciesTable < ActiveRecord::Migration t.column :from_resource_id, :integer, :null => true t.column :to_snapshot_id, :integer, :null => true t.column :to_resource_id, :integer, :null => true - t.column :dep_usage, :string, :null => true, :limit => 15 + t.column :dep_usage, :string, :null => true, :limit => 30 t.column :dep_weight, :integer, :null => true t.column :project_snapshot_id, :integer, :null => true t.column :parent_dependency_id, :big_integer, :null => true @@ -38,10 +38,4 @@ class CreateDependenciesTable < ActiveRecord::Migration add_index :dependencies, :to_snapshot_id, :name => 'deps_to_sid' end - def self.down - remove_index :dependencies, :name => 'deps_from_sid' - remove_index :dependencies, :name => 'deps_to_sid' - drop_table :dependencies - end - end diff --git a/sonar-server/src/main/webapp/WEB-INF/db/migrate/094_add_metrics_hidden_column.rb b/sonar-server/src/main/webapp/WEB-INF/db/migrate/094_add_metrics_hidden_column.rb deleted file mode 100644 index c5526de568e..00000000000 --- a/sonar-server/src/main/webapp/WEB-INF/db/migrate/094_add_metrics_hidden_column.rb +++ /dev/null @@ -1,31 +0,0 @@ -# -# Sonar, entreprise quality control tool. -# Copyright (C) 2008-2011 SonarSource -# mailto:contact AT sonarsource DOT com -# -# Sonar is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 3 of the License, or (at your option) any later version. -# -# Sonar is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with Sonar; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 -# -class AddMetricsHiddenColumn < ActiveRecord::Migration - - def self.up - add_column 'metrics', 'hidden', :boolean, :null => true - Metric.reset_column_information - Metric.clear_cache - end - - def self.down - remove_column 'metrics', 'hidden' - end -end diff --git a/sonar-server/src/main/webapp/WEB-INF/db/migrate/095_increase_measure_id_size.rb b/sonar-server/src/main/webapp/WEB-INF/db/migrate/095_increase_measure_id_size.rb index 14991a2a6a6..6f4139a9c1e 100644 --- a/sonar-server/src/main/webapp/WEB-INF/db/migrate/095_increase_measure_id_size.rb +++ b/sonar-server/src/main/webapp/WEB-INF/db/migrate/095_increase_measure_id_size.rb @@ -25,7 +25,4 @@ class IncreaseMeasureIdSize < ActiveRecord::Migration alter_to_big_integer('async_measure_snapshots', 'project_measure_id', 'async_m_s_measure_id') end - def self.down - - end end diff --git a/sonar-server/src/main/webapp/WEB-INF/db/migrate/097_increase_dep_usage_size.rb b/sonar-server/src/main/webapp/WEB-INF/db/migrate/097_increase_dep_usage_size.rb deleted file mode 100644 index 7322b8c8376..00000000000 --- a/sonar-server/src/main/webapp/WEB-INF/db/migrate/097_increase_dep_usage_size.rb +++ /dev/null @@ -1,29 +0,0 @@ -# -# Sonar, entreprise quality control tool. -# Copyright (C) 2008-2011 SonarSource -# mailto:contact AT sonarsource DOT com -# -# Sonar is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 3 of the License, or (at your option) any later version. -# -# Sonar is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with Sonar; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 -# -class IncreaseDepUsageSize < ActiveRecord::Migration - - def self.up - change_column('dependencies', 'dep_usage', :string, :limit => 30, :null => true) - end - - def self.down - - end -end diff --git a/sonar-server/src/main/webapp/WEB-INF/db/migrate/098_increase_snapshots_version.rb b/sonar-server/src/main/webapp/WEB-INF/db/migrate/098_increase_snapshots_version.rb deleted file mode 100644 index ede5e05dc5d..00000000000 --- a/sonar-server/src/main/webapp/WEB-INF/db/migrate/098_increase_snapshots_version.rb +++ /dev/null @@ -1,29 +0,0 @@ -# -# Sonar, entreprise quality control tool. -# Copyright (C) 2008-2011 SonarSource -# mailto:contact AT sonarsource DOT com -# -# Sonar is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 3 of the License, or (at your option) any later version. -# -# Sonar is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with Sonar; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 -# -class IncreaseSnapshotsVersion < ActiveRecord::Migration - - def self.up - change_column('snapshots', 'version', :string, :limit => 60, :null => true) - end - - def self.down - - end -end diff --git a/sonar-server/src/main/webapp/WEB-INF/db/migrate/099_delete_deprecated_libraries.rb b/sonar-server/src/main/webapp/WEB-INF/db/migrate/099_delete_deprecated_libraries.rb deleted file mode 100644 index e9ba4bffa59..00000000000 --- a/sonar-server/src/main/webapp/WEB-INF/db/migrate/099_delete_deprecated_libraries.rb +++ /dev/null @@ -1,39 +0,0 @@ -# -# Sonar, entreprise quality control tool. -# Copyright (C) 2008-2011 SonarSource -# mailto:contact AT sonarsource DOT com -# -# Sonar is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 3 of the License, or (at your option) any later version. -# -# Sonar is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with Sonar; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 -# -class DeleteDeprecatedLibraries < ActiveRecord::Migration - - def self.up - say_with_time "Deleting deprecated dependencies on libs..." do - Dependency.delete_all("from_scope='LIB' OR to_scope='LIB'") - end - - say_with_time "Deleting deprecated snapshots on libs..." do - Snapshot.delete_all("scope='LIB'") - end - - say_with_time "Deleting deprecated libs..." do - Project.delete_all("scope='LIB'") - end - end - - def self.down - - end -end diff --git a/sonar-server/src/main/webapp/WEB-INF/db/migrate/100_delete_checkstyle_regexp_rules.rb b/sonar-server/src/main/webapp/WEB-INF/db/migrate/100_delete_checkstyle_regexp_rules.rb deleted file mode 100644 index 7af3cdb223f..00000000000 --- a/sonar-server/src/main/webapp/WEB-INF/db/migrate/100_delete_checkstyle_regexp_rules.rb +++ /dev/null @@ -1,43 +0,0 @@ - # - # Sonar, entreprise quality control tool. - # Copyright (C) 2008-2011 SonarSource - # mailto:contact AT sonarsource DOT com - # - # Sonar is free software; you can redistribute it and/or - # modify it under the terms of the GNU Lesser General Public - # License as published by the Free Software Foundation; either - # version 3 of the License, or (at your option) any later version. - # - # Sonar is distributed in the hope that it will be useful, - # but WITHOUT ANY WARRANTY; without even the implied warranty of - # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - # Lesser General Public License for more details. - # - # You should have received a copy of the GNU Lesser General Public - # License along with Sonar; if not, write to the Free Software - # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 - # -class DeleteCheckstyleRegexpRules < ActiveRecord::Migration - - def self.up - delete_rule('com.puppycrawl.tools.checkstyle.checks.RegexpMultilineCheck') - delete_rule('com.puppycrawl.tools.checkstyle.checks.RegexpSinglelineCheck') - delete_rule('com.puppycrawl.tools.checkstyle.checks.RegexpSinglelineJavaCheck') - end - - def self.down - - end - - private - def self.delete_rule(rule_key) - rule=Rule.find(:first, :conditions => {:plugin_name => 'checkstyle', :plugin_rule_key => rule_key}) - if rule - say_with_time "Deleting Checkstyle rule #{rule_key}..." do - rule_id=rule.id - ActiveRule.destroy_all(["rule_id=?", rule_id]) - rule.destroy - end - end - end -end \ No newline at end of file