Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 15 additions & 7 deletions lib/tasks/data_migrator.rake
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ namespace :db do

RussellEdge::DataMigrator.new.migrate(nil, passed_version)

Rake::Task["db:schema:dump"].reenable
Rake::Task["db:schema:dump"].invoke
data_migrations_dump_db
end#end migrate_data task

namespace :migrate_data do
Expand All @@ -28,8 +27,7 @@ namespace :db do

RussellEdge::DataMigrator.new.run_up(passed_version)

Rake::Task["db:schema:dump"].reenable
Rake::Task["db:schema:dump"].invoke
data_migrations_dump_db
end#end up task

task :down => :environment do
Expand All @@ -38,8 +36,7 @@ namespace :db do

RussellEdge::DataMigrator.new.run_down(passed_version)

Rake::Task["db:schema:dump"].reenable
Rake::Task["db:schema:dump"].invoke
data_migrations_dump_db
end#end down task
end#end namespace
end
Expand Down Expand Up @@ -80,4 +77,15 @@ namespace :railties do
end #install
end #railties


def data_migrations_dump_db
case ActiveRecord::Base.schema_format
when :ruby
Rake::Task["db:schema:dump"].reenable
Rake::Task["db:schema:dump"].invoke
when :sql
Rake::Task["db:structure:dump"].reenable
Rake::Task["db:structure:dump"].invoke
else
raise "unknown schema format #{ActiveRecord::Base.schema_format}"
end
end