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
3 4 5 6 7 8 9 10 |
# File 'lib/backupper/dump_command.rb', line 3 def self.mysql(database:, username: 'root', password: nil, dump_options: nil, outfile:) params = [] params << "--databases '#{database}'" params << "-u#{username}" params << "-p#{password}" if password params << if return "mysqldump #{params.join(' ')} | bzip2 > '#{outfile}'" end |
.postgresql(database:, username: 'root', password: nil, dump_options: nil, outfile:) ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/backupper/dump_command.rb', line 12 def self.postgresql(database:, username: 'root', password: nil, dump_options: nil, outfile:) params = [] params << "-U #{username}" params << "'#{database}'" params << if return "PGPASSWORD=#{password} pg_dump #{params.join(' ')} | bzip2 > '#{outfile}'" end |