From ec7790748f9da5c5859f48b164f4bf4222ca6736 Mon Sep 17 00:00:00 2001 From: MrGeneration Date: Thu, 20 Aug 2020 15:54:49 +0200 Subject: [PATCH] Fixes #3139 - Restore script uses postgres user and nukes restoration of hosted dumps Previously restoring Zammad dumps (like those from a Hosted setup) couldn't be imported successfully, because the "owner" information is not provided by the dump. If that's the case, postgre SQL will use the current user you're importing with. If that's postgres and not Zammad, you can't read and use the database as Zammad user. --- contrib/backup/functions | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/backup/functions b/contrib/backup/functions index eed91755e..06d6503dd 100644 --- a/contrib/backup/functions +++ b/contrib/backup/functions @@ -188,7 +188,7 @@ function restore_zammad () { fi echo "# Restoring PostgrSQL DB" - zcat ${BACKUP_DIR}/${RESTORE_DB_DATE}_zammad_db.${DB_FILE_EXT}.gz | su -c "psql -d ${DB_NAME}" postgres + zcat ${BACKUP_DIR}/${RESTORE_DB_DATE}_zammad_db.${DB_FILE_EXT}.gz | su -c "psql -d ${DB_NAME}" zammad elif [ "${DB_ADAPTER}" == "mysql2" ]; then echo "# Restoring MySQL DB" zcat ${BACKUP_DIR}/${RESTORE_DB_DATE}_zammad_db.${DB_FILE_EXT}.gz | mysql -u${DB_USER} -p${DB_PASS} ${DB_NAME}