Files
Budget_Tool_Martinhal/budget-app/backup/restore.sh
T

8 lines
377 B
Bash
Raw Normal View History

2026-10-29 20:40:02 +00:00
#!/bin/sh
# Usage (from the project folder): docker compose exec backup restore.sh /backups/budget_YYYYMMDD_HHMMSS.sql.gz
set -eu
file="${1:?give the backup file, e.g. /backups/budget_20270101_023000.sql.gz}"
echo "Restoring $file into database $PGDATABASE ..."
gunzip -c "$file" | psql -q -v ON_ERROR_STOP=1
echo "Done. Restart the api container: docker compose restart api"