Class: Backhoe::Postgresql

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

Instance Attribute Summary

Attributes inherited from Base

#config, #file_path

Instance Method Summary collapse

Instance Method Details

#dump(**_) ⇒ Object

Raises:

  • (RuntimeError)


5
6
7
8
9
# File 'lib/backhoe/postgresql.rb', line 5

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)


11
12
13
14
15
# File 'lib/backhoe/postgresql.rb', line 11

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