fix(cleanup): delete failed database backup records after the retention days

Backup retention removes only successful runs, so failed runs stayed in
scheduled_database_backup_executions forever. A failed run has no local
file and no S3 copy, so the daily database cleanup can delete its record.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Andras Bacsai
2026-11-10 11:00:05 +01:00
co-authored by Claude Opus 5.5
parent 30335d8086
commit cd8abbf7b4
2 changed files with 10 additions and 0 deletions
@@ -0,0 +1,6 @@
---
type: fixed
---
Kept the records of failed database backups forever
- The daily database cleanup deletes failed database backups that are older than 60 days
+4
View File
@@ -48,6 +48,10 @@ class CleanupDatabase extends Command
$this->cleanupTable('scheduled_task_executions', 'created_at', now()->subDays($keep_days));
// Backup retention removes only successful runs. A failed run has no file, so only its record is left.
$this->cleanupTable('scheduled_database_backup_executions', 'created_at', now()->subDays($keep_days), fn (Builder $query) => $query
->where('status', 'failed'));
$this->cleanupTable('github_runner_executions', 'created_at', now()->subDays($keep_days), fn (Builder $query) => $query
->whereNotIn('status', array_map(fn (GithubRunnerStatus $status): string => $status->value, GithubRunnerStatus::active())));
}