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.
This commit is contained in:
MrGeneration 2020-08-20 15:54:49 +02:00 committed by Thorsten Eckel
parent b1e75841f4
commit ec7790748f

View file

@ -188,7 +188,7 @@ function restore_zammad () {
fi fi
echo "# Restoring PostgrSQL DB" 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 elif [ "${DB_ADAPTER}" == "mysql2" ]; then
echo "# Restoring MySQL DB" 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} zcat ${BACKUP_DIR}/${RESTORE_DB_DATE}_zammad_db.${DB_FILE_EXT}.gz | mysql -u${DB_USER} -p${DB_PASS} ${DB_NAME}