Maintenance: Enhance postgres dumps to be owner less

This commit removes owner ship information for upcoming database dumps. With this step the dumps are fully compatible between hosted & selfhosted.

Plus, if you use another use for restoration for whatever reason, the desired restoration may get easier.

In restoration terms this was covered by commit 764062907fd46c81b7dda03197d209408d443ae9
This commit is contained in:
MrGeneration 2020-08-20 16:20:17 +02:00 committed by Thorsten Eckel
parent ec7790748f
commit 3b27e6cb8b

View file

@ -51,7 +51,8 @@ function backup_db () {
ln -sfn ${BACKUP_DIR}/${TIMESTAMP}_zammad_db.mysql.gz ${BACKUP_DIR}/latest_zammad_db.mysql.gz
elif [ "${DB_ADAPTER}" == "postgresql" ]; then
echo "creating postgresql backup..."
su -c "pg_dump -c ${DB_NAME} | gzip > /tmp/${TIMESTAMP}_zammad_db.psql.gz" postgres
su -c "pg_dump --no-privileges --no-owner -c ${DB_NAME} | \
gzip > /tmp/${TIMESTAMP}_zammad_db.psql.gz" postgres
mv /tmp/${TIMESTAMP}_zammad_db.psql.gz ${BACKUP_DIR}
ln -sfn ${BACKUP_DIR}/${TIMESTAMP}_zammad_db.psql.gz ${BACKUP_DIR}/latest_zammad_db.psql.gz
else