Module: DumpCommand

Defined in:
lib/backupper/dump_command.rb

Class Method Summary collapse

Class Method Details

.mysql(database:, username: 'root', password: nil, dump_options: nil, outfile:) ⇒ Object



2
3
4
5
6
7
8
# File 'lib/backupper/dump_command.rb', line 2

def self.mysql(database:, username: 'root', password: nil, dump_options: nil, outfile:)
  params = []
  params << "-u'#{username}'"
  params << "-p'#{password}'" if password
  params << dump_options if dump_options
  return "mysqldump '#{database}' #{params.join(' ')} | bzip2 > '#{outfile}'"
end

.postgresql(database:, username: 'root', password: nil, dump_options: nil, outfile:) ⇒ Object



10
11
12
13
14
15
# File 'lib/backupper/dump_command.rb', line 10

def self.postgresql(database:, username: 'root', password: nil, dump_options: nil, outfile:)
  params = []
  params << "-U '#{username}'"
  params << dump_options if dump_options
  return "PGPASSWORD='#{password}' pg_dump '#{database}' #{params.join(' ')} | bzip2 > '#{outfile}'"
end