feat: ship blog platform admin and deploy stack
This commit is contained in:
21
deploy/scripts/backup/restore-postgres.sh
Normal file
21
deploy/scripts/backup/restore-postgres.sh
Normal file
@@ -0,0 +1,21 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
if [[ $# -lt 1 ]]; then
|
||||
echo "Usage: $0 <backup-file.dump>" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ -z "${DATABASE_URL:-}" ]]; then
|
||||
echo "DATABASE_URL is required" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
BACKUP_FILE="$1"
|
||||
if [[ ! -f "${BACKUP_FILE}" ]]; then
|
||||
echo "Backup file not found: ${BACKUP_FILE}" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
pg_restore --clean --if-exists --no-owner --no-privileges --dbname="${DATABASE_URL}" "${BACKUP_FILE}"
|
||||
echo "Postgres restore completed from ${BACKUP_FILE}"
|
||||
Reference in New Issue
Block a user