Module: DumpCommand
- Defined in:
- lib/backupper/dump_command.rb
Class Method Summary collapse
- .mysql(database:, username: 'root', password: nil, dump_options: nil, outfile:) ⇒ Object
- .postgresql(database:, username: 'root', password: nil, dump_options: nil, outfile:) ⇒ Object
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 << if 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 << if return "PGPASSWORD='#{password}' pg_dump '#{database}' #{params.join(' ')} | bzip2 > '#{outfile}'" end |