Refactor database cleanup command to include dry-run mode
This commit is contained in:
parent
b576014d07
commit
6ef79f5213
@ -12,9 +12,13 @@ class CleanupDatabase extends Command
|
|||||||
|
|
||||||
public function handle()
|
public function handle()
|
||||||
{
|
{
|
||||||
echo "Running database cleanup...\n";
|
if ($this->option('yes')) {
|
||||||
|
echo "Running database cleanup...\n";
|
||||||
|
} else {
|
||||||
|
echo "Running database cleanup in dry-run mode...\n";
|
||||||
|
}
|
||||||
$keep_days = 60;
|
$keep_days = 60;
|
||||||
|
echo "Keep days: $keep_days\n";
|
||||||
// Cleanup failed jobs table
|
// Cleanup failed jobs table
|
||||||
$failed_jobs = DB::table('failed_jobs')->where('failed_at', '<', now()->subDays(7));
|
$failed_jobs = DB::table('failed_jobs')->where('failed_at', '<', now()->subDays(7));
|
||||||
$count = $failed_jobs->count();
|
$count = $failed_jobs->count();
|
||||||
|
Loading…
Reference in New Issue
Block a user