From bfe420001209dff891325fcd68af872218079612 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Tue, 28 Jan 2025 10:19:41 +0100 Subject: [PATCH] fix: cleanup old scheduled_task_executions --- app/Console/Commands/CleanupDatabase.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/app/Console/Commands/CleanupDatabase.php b/app/Console/Commands/CleanupDatabase.php index a0adc8b36..2ccb76529 100644 --- a/app/Console/Commands/CleanupDatabase.php +++ b/app/Console/Commands/CleanupDatabase.php @@ -57,6 +57,14 @@ class CleanupDatabase extends Command $application_deployment_queues->delete(); } + // Cleanup scheduled_task_executions table + $scheduled_task_executions = DB::table('scheduled_task_executions')->where('created_at', '<', now()->subDays($keep_days))->orderBy('created_at', 'desc'); + $count = $scheduled_task_executions->count(); + echo "Delete $count entries from scheduled_task_executions.\n"; + if ($this->option('yes')) { + $scheduled_task_executions->delete(); + } + // Cleanup webhooks table $webhooks = DB::table('webhooks')->where('created_at', '<', now()->subDays($keep_days)); $count = $webhooks->count();