Class: KamalBackup::Databases::Mysql

Inherits:
Base
  • Object
show all
Defined in:
lib/kamal_backup/databases/mysql.rb

Instance Attribute Summary

Attributes inherited from Base

#config, #redactor

Instance Method Summary collapse

Methods inherited from Base

#backup, #backup_tags, #database_filename, #initialize, #restore, #validate_restore_target!

Constructor Details

This class inherits a constructor from KamalBackup::Databases::Base

Instance Method Details

#adapter_nameObject



7
8
9
# File 'lib/kamal_backup/databases/mysql.rb', line 7

def adapter_name
  "mysql"
end

#dump_commandObject



15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/kamal_backup/databases/mysql.rb', line 15

def dump_command
  connection = backup_connection
  argv = [
    dump_binary,
    "--single-transaction",
    "--quick",
    "--routines",
    "--triggers",
    "--events"
  ] + connection_args(connection)
  argv << connection.fetch(:database)
  CommandSpec.new(argv: argv, env: password_env(connection))
end

#dump_extensionObject



11
12
13
# File 'lib/kamal_backup/databases/mysql.rb', line 11

def dump_extension
  "sql"
end

#restore_commandObject



29
30
31
32
33
34
# File 'lib/kamal_backup/databases/mysql.rb', line 29

def restore_command
  connection = restore_connection
  argv = [client_binary] + connection_args(connection)
  argv << connection.fetch(:database)
  CommandSpec.new(argv: argv, env: password_env(connection))
end

#restore_target_identifierObject



36
37
38
39
# File 'lib/kamal_backup/databases/mysql.rb', line 36

def restore_target_identifier
  connection = restore_connection
  [connection[:host], connection[:database]].compact.join("/")
end