feat(db_manager): avoid extraction of DB dump if gzipped
Use `gzip -cd` to directly get the contents onto stdout and pipe to mariadb Signed-off-by: Akhil Narang <me@akhilnarang.dev>
This commit is contained in:
parent
7db8baa7c4
commit
0b508e2a96
1 changed files with 16 additions and 5 deletions
|
|
@ -61,12 +61,23 @@ class DbManager:
|
|||
|
||||
command = []
|
||||
|
||||
if pv:
|
||||
command.extend([pv, source, "|"])
|
||||
source = []
|
||||
print("Restoring Database file...")
|
||||
if source.endswith(".gz"):
|
||||
if gzip := which("gzip"):
|
||||
source = []
|
||||
command.extend([gzip, "-cd", source, "|"])
|
||||
if pv:
|
||||
command.extend([pv, "|"])
|
||||
print("Restoring Database file...")
|
||||
else:
|
||||
raise Exception("`gzip` not installed")
|
||||
|
||||
else:
|
||||
source = ["<", source]
|
||||
if pv:
|
||||
command.extend([pv, source, "|"])
|
||||
source = []
|
||||
print("Restoring Database file...")
|
||||
else:
|
||||
source = ["<", source]
|
||||
|
||||
bin, args, bin_name = get_command(
|
||||
host=frappe.conf.db_host,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue