Class: KamalBackup::Databases::Mysql
- Inherits:
-
Base
- Object
- Base
- KamalBackup::Databases::Mysql
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, build, #database_filename, #initialize, #restore_to_current, #restore_to_scratch
Instance Method Details
#adapter_name ⇒ Object
9
10
11
|
# File 'lib/kamal_backup/databases/mysql.rb', line 9
def adapter_name
'mysql'
end
|
#current_restore_command ⇒ Object
31
32
33
34
35
36
|
# File 'lib/kamal_backup/databases/mysql.rb', line 31
def current_restore_command
connection = current_connection
argv = [client_binary] + connection_args(connection)
argv << connection.fetch(:database)
CommandSpec.new(argv: argv, env: password_env(connection))
end
|
#current_target_identifier ⇒ Object
45
46
47
48
|
# File 'lib/kamal_backup/databases/mysql.rb', line 45
def current_target_identifier
connection = current_connection
[connection[:host], connection[:database]].compact.join('/')
end
|
#dump_command ⇒ Object
17
18
19
20
21
22
23
24
25
26
27
28
29
|
# File 'lib/kamal_backup/databases/mysql.rb', line 17
def dump_command
connection = current_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_extension ⇒ Object
13
14
15
|
# File 'lib/kamal_backup/databases/mysql.rb', line 13
def dump_extension
'sql'
end
|
#scratch_restore_command(target) ⇒ Object
38
39
40
41
42
43
|
# File 'lib/kamal_backup/databases/mysql.rb', line 38
def scratch_restore_command(target)
connection = current_connection.merge(database: target)
argv = [client_binary] + connection_args(connection)
argv << target
CommandSpec.new(argv: argv, env: password_env(connection))
end
|
#scratch_target_identifier(target) ⇒ Object
50
51
52
|
# File 'lib/kamal_backup/databases/mysql.rb', line 50
def scratch_target_identifier(target)
[current_connection[:host], target].compact.join('/')
end
|