[#4184] Export old Deliverable data.
This commit is contained in:
@@ -2,6 +2,10 @@ require 'pp'
|
||||
|
||||
module RedmineContracts
|
||||
class BudgetPluginInstalledError < StandardError; end
|
||||
|
||||
class BudgetPluginDeliverable < ActiveRecord::Base
|
||||
set_table_name 'deliverables'
|
||||
end
|
||||
|
||||
# TODO: decide how this is activated.
|
||||
# Have the user dump yaml themselves? Or rename the tables and
|
||||
@@ -18,10 +22,12 @@ module RedmineContracts
|
||||
|
||||
def self.rename_old_tables
|
||||
ActiveRecord::Migration.rename_table(:deliverables, :budget_plugin_deliverables)
|
||||
Deliverable.reset_column_information
|
||||
RedmineContracts::BudgetPluginDeliverable.reset_column_information
|
||||
end
|
||||
|
||||
def self.export_data
|
||||
|
||||
RedmineContracts::BudgetPluginDeliverable.all.collect {|d| d.attributes}.to_yaml
|
||||
end
|
||||
|
||||
def self.migrate_contracts
|
||||
|
||||
@@ -2,9 +2,9 @@ namespace :redmine_contracts do
|
||||
desc "Migrate data from the budget_plugin to redmine_contracts"
|
||||
task :budget_migration => :environment do
|
||||
RedmineContracts::BudgetPluginMigration.check_for_installed_budget_plugin
|
||||
data = RedmineContracts::BudgetPluginMigration.export_data
|
||||
RedmineContracts::BudgetPluginMigration.rename_old_tables
|
||||
RedmineContracts::BudgetPluginMigration.export_data
|
||||
RedmineContracts::BudgetPluginMigration.migrate_contracts
|
||||
# RedmineContracts::BudgetPluginMigration.migrate
|
||||
RedmineContracts::BudgetPluginMigration.migrate(data)
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user