Skip to content

Commit

Permalink
copy some private helper methods from ActiveRecord::Tasks::DatabaseTasks
Browse files Browse the repository at this point in the history
Ideally we should reference these directly, I will probably rewrite this commit when I get a moment to work out how.
  • Loading branch information
Floppy committed Jun 20, 2024
1 parent 9f7a3c8 commit cd8bae1
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions lib/data_migrate/database_tasks.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,22 @@ def migration_connection # :nodoc:
ensure
migration_class.connection_handler.establish_connection(original_db_config)
end

def with_temporary_pool(db_config)
original_db_config = migration_class.connection_db_config
pool = migration_class.establish_connection(db_config)
yield pool
ensure
migration_class.establish_connection(original_db_config)
end

def migration_class # :nodoc:
ActiveRecord::Base
end

def migration_connection # :nodoc:
migration_class.connection
end
end

def db_configs_with_versions
Expand Down

0 comments on commit cd8bae1

Please sign in to comment.