Refactor cleanup:database command signature to include optional --keep-days parameter

This commit is contained in:
Andras Bacsai
2024-11-01 21:38:20 +01:00
parent 369e99a2c9
commit 5967d70713

View File

@@ -7,7 +7,7 @@ use Illuminate\Support\Facades\DB;
class CleanupDatabase extends Command
{
protected $signature = 'cleanup:database {--yes}';
protected $signature = 'cleanup:database {--yes} {--keep-days=}';
protected $description = 'Cleanup database';
@@ -20,9 +20,9 @@ class CleanupDatabase extends Command
}
if (isCloud()) {
// Later on we can increase this to 180 days or dynamically set
$keep_days = 60;
$keep_days = $this->option('keep-days') ?? 60;
} else {
$keep_days = 60;
$keep_days = $this->option('keep-days') ?? 60;
}
echo "Keep days: $keep_days\n";
// Cleanup failed jobs table