Doe not restore database if table check fails

This commit is contained in:
Charlie Root 2024-06-23 13:49:28 +02:00
parent 62d8e69d19
commit e7596c6ec7
1 changed files with 5 additions and 1 deletions

View File

@ -240,7 +240,7 @@ vars:
"classname" string => "mysql_$(dbdef[db_name])_$(table_name)_exists"; "classname" string => "mysql_$(dbdef[db_name])_$(table_name)_exists";
"cmd" string => 'if mysql $(xargs) -e "show tables LIKE \'$(table_name)\'" $(dbdef[db_name]) | grep -q \'$(table_name)\'; then echo "+$(classname)"; else echo "-$(classname)"; fi'; "cmd" string => 'mysql $(xargs) -e "show tables LIKE \'$(table_name)\'" $(dbdef[db_name]) > /tmp/$(dbdef[db_name]).check && if grep -q \'$(table_name)\' /tmp/$(dbdef[db_name]).check ; then echo "+$(classname)"; else echo "-$(classname)"; fi';
commands: commands:
"$(cmd)" "$(cmd)"
@ -444,6 +444,10 @@ methods:
"any" usebundle => restore_mysql_db(@(cfg),"$(file)"), "any" usebundle => restore_mysql_db(@(cfg),"$(file)"),
depends_on=>{"$(table_exists)_checked"}; depends_on=>{"$(table_exists)_checked"};
reports: reports:
#"!$(table_exists)&backup_exists"::
# "DB DOES NOT EXISTS";
#"$(table_exists)&backup_exists"::
# "DB DOES EXISTS";
} }