An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.
PHP coolifydatabasesdeploymentdockerdocker-composeinertiajslaravelmariadbmysqlnextjsnodejsphppostgresredisself-hostedself-hostingserverstatic-sitesveltesvelte5
Refactor database cleanup queries to keep the last 10 entries
Andras Bacsai85c36df2a3f5
diff --git a/app/Console/Commands/CleanupDatabase.php b/app/Console/Commands/CleanupDatabase.phpindex 110e49c491..0c8f9b884e 100644--- a/app/Console/Commands/CleanupDatabase.php+++ b/app/Console/Commands/CleanupDatabase.php@@ -36,7 +36,8 @@ class CleanupDatabase extends Command}// Cleanup activity_log table- $activity_log = DB::table('activity_log')->where('created_at', '<', now()->subDays($keep_days));+ // but keep the last 10+ $activity_log = DB::table('activity_log')->where('created_at', '<', now()->subDays($keep_days))->orderBy('created_at', 'desc')->skip(10);$count = $activity_log->count();echo "Delete $count entries from activity_log.\n";if ($this->option('yes')) {@@ -44,7 +45,7 @@ class CleanupDatabase extends Command}// Cleanup application_deployment_queues table- $application_deployment_queues = DB::table('application_deployment_queues')->where('created_at', '<', now()->subDays($keep_days));+ $application_deployment_queues = DB::table('application_deployment_queues')->where('created_at', '<', now()->subDays($keep_days))->orderBy('created_at', 'desc')->skip(10);$count = $application_deployment_queues->count();echo "Delete $count entries from application_deployment_queues.\n";if ($this->option('yes')) {@@ -52,7 +53,7 @@ class CleanupDatabase extends Command}// Cleanup webhooks table- $webhooks = DB::table('webhooks')->where('created_at', '<', now()->subDays($keep_days));+ $webhooks = DB::table('webhooks')->where('created_at', '<', now()->subDays($keep_days))->orderBy('created_at', 'desc')->skip(10);$count = $webhooks->count();echo "Delete $count entries from webhooks.\n";if ($this->option('yes')) {