From 88780f44b039edcf8096e27bdf8789c88ea33a33 Mon Sep 17 00:00:00 2001 From: oleole39 Date: Fri, 20 Jan 2023 04:07:25 +0100 Subject: [PATCH] Simplified helper ynh_psql_dump_all_user_dbs in file _common.sh --- scripts/_common.sh | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index 90c2757..8acc895 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -140,18 +140,12 @@ ynh_psql_dump_all_user_dbs() { local dbs_to_dump = ynh_psql_list_user_dbs $db_user if [ -n "$dbs_to_dump" ]; then # Check that the list of database(s) is not empty - local app_tag - if [ -n "$app" ]; then - app_tag = "${app}-" - else - app_tag = "" - fi local db_name for $db_name in $dbs_to_dump # Iterate through the list of database(s) to dump do if ynh_psql_database_exists --database=$db_name; then # Check if the database exists - ynh_psql_dump_db $db_name > "${app_tag}${db_name}-dump.sql" # Dump the database to a filename format of app-db_name-dump.sql, or of db_name-dump.sql if app parameter was not supplied + ynh_psql_dump_db $db_name > "$app-$db_name-dump.sql" # Dump the database to a filename format of app-db_name-dump.sql, or of db_name-dump.sql if app parameter was not supplied ynh_print_info --message="Dumped database $db_name associated to role $db_user" else ynh_print_warn --message="Database $db_name not found"