Class: Backhoe::Postgresql

Inherits:
Base
  • Object
show all
Defined in:
lib/backhoe.rb

Instance Attribute Summary

Attributes inherited from Base

#config, #file_path

Instance Method Summary collapse

Instance Method Details

#dump(**_) ⇒ Object

Raises:

  • (RuntimeError)


81
82
83
84
85
# File 'lib/backhoe.rb', line 81

def dump **_
  pg_dump = `which pg_dump`.strip
  raise RuntimeError, "Cannot find pg_dump." if pg_dump.blank?
  sh "#{pg_dump} -c -f#{file_path} #{database}"
end

#loadObject

Raises:

  • (RuntimeError)


87
88
89
90
91
# File 'lib/backhoe.rb', line 87

def load
  psql = `which psql`.strip
  raise RuntimeError, "Cannot find psql." if psql.blank?
  sh "#{psql} -q -d#{database} -f#{file_path}"
end