Module: ActiveRecord::Tasks::DatabaseTasks

Defined in:
lib/pg_tasks.rb

Instance Method Summary collapse

Instance Method Details

#perform_pg_db_task_for_config_and_filename(task_name, *arguments) ⇒ Object



147
148
149
150
151
152
153
154
155
156
157
# File 'lib/pg_tasks.rb', line 147

def perform_pg_db_task_for_config_and_filename(task_name, *arguments)
  configuration = arguments.first
  filename = arguments.delete_at 1
  class_for_adapter(configuration['adapter']) \
    .new(*arguments).send task_name, filename
rescue ActiveRecord::NoDatabaseError
  $stderr.puts "Database '#{configuration['database']}' does not exist"
rescue Exception => error
  $stderr.puts error, *(error.backtrace)
  raise error
end

#terminate_connections(*arguments) ⇒ Object



159
160
161
162
163
# File 'lib/pg_tasks.rb', line 159

def terminate_connections(*arguments)
  configuration = arguments.first
  class_for_adapter(configuration['adapter']) \
    .new(*arguments).send :terminate_connections
end