Class: Bard::Rake::Postgresql

Inherits:
Object
  • Object
show all
Extended by:
Rake::DSL
Defined in:
lib/bard/rake/db_dump_load.rb

Class Method Summary collapse

Class Method Details

.dumpObject

Raises:

  • (RuntimeError)


51
52
53
54
55
# File 'lib/bard/rake/db_dump_load.rb', line 51

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)


57
58
59
60
61
# File 'lib/bard/rake/db_dump_load.rb', line 57

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