3 Commits

Author SHA1 Message Date
copilot-swe-agent[bot] 9a95d5cfd5 test: increase backup_tasks.py coverage to 99.79%
Add comprehensive tests covering all previously untested code paths in
app/tasks/backup_tasks.py, raising coverage from 66.39% to 99.79%.

New test classes:
- TestDumpPostgresqlBranches / TestDumpMysqlBranches: URL branches
- TestRestoreSqliteBranches: error paths and rollback scenarios
- TestRestorePostgresqlBranches / TestRestoreMysqlBranches: URL branches
- TestApplyRetentionOSError: OSError on file removal + remote record keeping
- TestPruneRemoteBackups: full pruning lifecycle
- TestDeleteRemoteCopy: S3, Dropbox, known/unknown destinations
- TestUploadRemote: all destination branches (S3, Dropbox, email, Nextcloud, WebDAV)
- TestEmailBackup: recipient error, TLS, no-auth paths
- TestCreateBackupAdditional: dump failure, remote upload, PG/MySQL failures
- TestCleanupOldBackupsTask: validates all tiers are processed

Co-authored-by: christianlouis <361235+christianlouis@users.noreply.github.com>
2026-03-08 12:11:07 +00:00
copilot-swe-agent[bot] a0f5ba1799 feat(backup): extend backup and restore to PostgreSQL and MySQL/MariaDB
Co-authored-by: christianlouis <361235+christianlouis@users.noreply.github.com>
2026-03-08 09:56:58 +00:00
copilot-swe-agent[bot] 2dd1ca0197 feat(backup): add database backup/restore with scheduled retention and admin dashboard
- Add BackupRecord model for tracking backup archives
- Add migration 021_add_backup_records
- Add backup configuration settings (backup_enabled, backup_dir, backup_remote_destination, backup_remote_folder, backup_retain_hourly/daily/weekly)
- Add backup_tasks.py with create_backup, cleanup_old_backups, and helpers
- Register hourly/daily/weekly Celery beat schedules
- Add /api/admin/backup/* REST endpoints (list, create, download, restore, delete, cleanup)
- Add /admin/backup dashboard view and template
- Add backup link to admin dropdown navigation in base.html
- Add backup settings to SETTING_METADATA in settings_service.py
- Add comprehensive test suite (39 tests passing)

Co-authored-by: christianlouis <361235+christianlouis@users.noreply.github.com>
2026-03-07 22:03:27 +00:00