Class: KamalBackup::Databases::Sqlite
- Inherits:
-
Base
- Object
- Base
- KamalBackup::Databases::Sqlite
show all
- Defined in:
- lib/kamal_backup/databases/sqlite.rb
Instance Attribute Summary
Attributes inherited from Base
#config, #redactor
Instance Method Summary
collapse
Methods inherited from Base
#backup_tags, build, #current_restore_command, #database_filename, #initialize, #scratch_restore_command
Instance Method Details
#adapter_name ⇒ Object
9
10
11
|
# File 'lib/kamal_backup/databases/sqlite.rb', line 9
def adapter_name
"sqlite"
end
|
#backup(restic, timestamp) ⇒ Object
17
18
19
20
21
22
23
24
25
26
27
28
|
# File 'lib/kamal_backup/databases/sqlite.rb', line 17
def backup(restic, timestamp)
source = sqlite_source
Tempfile.create(["kamal-backup-", ".sqlite3"]) do |tempfile|
tempfile.close
backup_to_file(source, tempfile.path)
restic.backup_file(
tempfile.path,
filename: database_filename(timestamp),
tags: backup_tags(timestamp)
)
end
end
|
#current_target_identifier ⇒ Object
43
44
45
|
# File 'lib/kamal_backup/databases/sqlite.rb', line 43
def current_target_identifier
sqlite_source
end
|
#dump_command ⇒ Object
39
40
41
|
# File 'lib/kamal_backup/databases/sqlite.rb', line 39
def dump_command
raise NotImplementedError, "SQLite backup uses .backup into a temporary file"
end
|
#dump_extension ⇒ Object
13
14
15
|
# File 'lib/kamal_backup/databases/sqlite.rb', line 13
def dump_extension
"sqlite3"
end
|
#restore_to_current(restic, snapshot, filename) ⇒ Object
30
31
32
|
# File 'lib/kamal_backup/databases/sqlite.rb', line 30
def restore_to_current(restic, snapshot, filename)
restic.write_dump_to_path(snapshot, filename, sqlite_source)
end
|
#restore_to_scratch(restic, snapshot, filename, target:) ⇒ Object
34
35
36
37
|
# File 'lib/kamal_backup/databases/sqlite.rb', line 34
def restore_to_scratch(restic, snapshot, filename, target:)
validate_scratch_restore_target(target)
restic.write_dump_to_path(snapshot, filename, target)
end
|
#scratch_target_identifier(target) ⇒ Object
47
48
49
|
# File 'lib/kamal_backup/databases/sqlite.rb', line 47
def scratch_target_identifier(target)
target
end
|