diff --git a/CHANGELOG.md b/CHANGELOG.md index c6358bd9d2..94600e90f3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ # Changelog +* `#2449` Squash old migrations + ## 4.0.0.pre6 * New core version dependency. diff --git a/db/migrate/20101111150110_adjust_cost_query_layout.rb b/db/migrate/20101111150110_adjust_cost_query_layout.rb deleted file mode 100644 index 527517a4c2..0000000000 --- a/db/migrate/20101111150110_adjust_cost_query_layout.rb +++ /dev/null @@ -1,17 +0,0 @@ -class AdjustCostQueryLayout < ActiveRecord::Migration - def self.up - remove_column :cost_queries, :filters - remove_column :cost_queries, :group_by - remove_column :cost_queries, :granularity - - add_column :cost_queries, :yamlized, :string, :null => true - end - - def self.down - add_column :cost_queries, :filters, :text - add_column :cost_queries, :group_bys, :text - add_column :cost_queries, :granularity, :string - - remove_column :cost_queries, :yamlized - end -end diff --git a/db/migrate/20101124150110_adjust_cost_query_layout_some_more.rb b/db/migrate/20101124150110_adjust_cost_query_layout_some_more.rb deleted file mode 100644 index af4e869703..0000000000 --- a/db/migrate/20101124150110_adjust_cost_query_layout_some_more.rb +++ /dev/null @@ -1,11 +0,0 @@ -class AdjustCostQueryLayoutSomeMore < ActiveRecord::Migration - def self.up - remove_column :cost_queries, :display_cost_entries - remove_column :cost_queries, :display_time_entries - end - - def self.down - add_column :cost_queries, :display_cost_entries, :boolean, :default => true - add_column :cost_queries, :display_time_entries, :boolean, :default => true - end -end diff --git a/db/migrate/20101202142038_change_cost_query_yaml_length.rb b/db/migrate/20101202142038_change_cost_query_yaml_length.rb deleted file mode 100644 index 81a99e264a..0000000000 --- a/db/migrate/20101202142038_change_cost_query_yaml_length.rb +++ /dev/null @@ -1,9 +0,0 @@ -class ChangeCostQueryYamlLength < ActiveRecord::Migration - def self.up - change_column :cost_queries, :yamlized, :string, :limit => 2000, :null => false - end - - def self.down - change_column :cost_queries, :yamlized, :string, :length => 255, :null => false - end -end diff --git a/db/migrate/20101203110501_rename_yamlized_to_serialized.rb b/db/migrate/20101203110501_rename_yamlized_to_serialized.rb deleted file mode 100644 index 3f5f9374f4..0000000000 --- a/db/migrate/20101203110501_rename_yamlized_to_serialized.rb +++ /dev/null @@ -1,9 +0,0 @@ -class RenameYamlizedToSerialized < ActiveRecord::Migration - def self.up - rename_column :cost_queries, :yamlized, :serialized - end - - def self.down - rename_column :cost_queries, :serialized, :yamlized - end -end diff --git a/db/migrate/20110215143010_add_timestamps_to_custom_fields.rb b/db/migrate/20110215143010_add_timestamps_to_custom_fields.rb deleted file mode 100644 index f72bd9e85a..0000000000 --- a/db/migrate/20110215143010_add_timestamps_to_custom_fields.rb +++ /dev/null @@ -1,9 +0,0 @@ -class AddTimestampsToCustomFields < ActiveRecord::Migration - def self.up - add_timestamps :custom_fields - end - - def self.down - remove_timestamps :custom_fields - end -end diff --git a/db/migrate/20110215143061_aggregated_reporting_migrations.rb b/db/migrate/20110215143061_aggregated_reporting_migrations.rb new file mode 100644 index 0000000000..931f033f20 --- /dev/null +++ b/db/migrate/20110215143061_aggregated_reporting_migrations.rb @@ -0,0 +1,38 @@ +require Rails.root.join("db","migrate","migration_utils","migration_squasher").to_s +require 'open_project/plugins/migration_mapping' +# This migration aggregates the migrations detailed in MIGRATION_FILES +class AggregatedReportingMigrations < ActiveRecord::Migration + + MIGRATION_FILES = <<-MIGRATIONS + 20101111150110_adjust_cost_query_layout.rb + 20101124150110_adjust_cost_query_layout_some_more.rb + 20101202142038_change_cost_query_yaml_length.rb + 20101203110501_rename_yamlized_to_serialized.rb + 20110215143010_add_timestamps_to_custom_fields.rb + MIGRATIONS + + OLD_PLUGIN_NAME = "redmine_reporting" + + def up + migration_names = OpenProject::Plugins::MigrationMapping.migration_files_to_migration_names(MIGRATION_FILES, OLD_PLUGIN_NAME) + Migration::MigrationSquasher.squash(migration_names) do + create_table "cost_queries" do |t| + t.integer "user_id", :null => false + t.integer "project_id" + t.string "name", :null => false + t.boolean "is_public", :default => false, :null => false + t.datetime "created_on", :null => false + t.datetime "updated_on", :null => false + t.string "serialized", :limit => 2000, :null => false + end + + add_timestamps :custom_fields + end + end + + def down + drop_table "cost_queries" + remove_timestamps :custom_fields + end +end + diff --git a/lib/open_project/reporting/engine.rb b/lib/open_project/reporting/engine.rb index 8de078b195..766b7f983d 100644 --- a/lib/open_project/reporting/engine.rb +++ b/lib/open_project/reporting/engine.rb @@ -34,6 +34,14 @@ module OpenProject::Reporting FactoryGirl.definition_file_paths << File.expand_path(self.root.to_s + '/spec/factories') if defined?(FactoryGirl) end + initializer :append_migrations do |app| + unless app.root.to_s.match root.to_s + config.paths["db/migrate"].expanded.each do |expanded_path| + app.config.paths["db/migrate"] << expanded_path + end + end + end + config.to_prepare do require_dependency 'report/walker' require_dependency 'report/transformer'