pdf-quiz-generator/backup-db.sh
Daniel 8137d5b20c Decouple course quizzes, replace passlib, add security hardening
- Fully decouple course quizzes from main quiz system (hidden from
  dashboard stats, history, search, results page)
- Course quiz results show "Back to Course" instead of retake/delete
- Add allow_review toggle for course creators to control answer review
- Show quiz title on course page, hide pool size from students
- Add course thumbnails to browse cards
- Replace passlib with bcrypt directly (compatible with existing hashes)
- Add HIBP breached password warnings on register/reset/change password
- Add CLI management tools (reset-password, set-role, stats, etc.)
- Fix quiz PATCH endpoint: ownership check instead of moderator-only
- Add max_length validation on course/module/lesson titles
- Fix score display bug on results page (0 of N when review disabled)
- Fix question count on course quiz start (show per-attempt, not pool)
- Improve suspend warning for timed course quizzes with max attempts
- Clean up validation error messages (show "Invalid email" not Pydantic dump)
- Add DDL migration for allow_review column

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-06 21:31:05 +02:00

25 lines
812 B
Bash
Executable file

#!/bin/bash
# Periodic PostgreSQL backup for PedsHub
# Keeps the last 14 daily backups, rotating old ones out.
BACKUP_DIR="/home/danvics/docker/quiz/backups"
COMPOSE_DIR="/home/danvics/docker/quiz"
TIMESTAMP=$(date +%Y%m%d_%H%M%S)
FILENAME="pedquiz_${TIMESTAMP}.sql.gz"
mkdir -p "$BACKUP_DIR"
# Dump via the running postgres container
docker compose -f "$COMPOSE_DIR/docker-compose.yml" exec -T postgres \
pg_dump -U pedquiz pedquiz | gzip > "$BACKUP_DIR/$FILENAME"
if [ $? -eq 0 ] && [ -s "$BACKUP_DIR/$FILENAME" ]; then
echo "[$(date)] Backup OK: $FILENAME ($(du -h "$BACKUP_DIR/$FILENAME" | cut -f1))"
else
echo "[$(date)] Backup FAILED" >&2
rm -f "$BACKUP_DIR/$FILENAME"
exit 1
fi
# Rotate: keep last 14 backups
ls -1t "$BACKUP_DIR"/pedquiz_*.sql.gz 2>/dev/null | tail -n +15 | xargs -r rm --