move into sonardesk
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\AI\Console;
|
||||
|
||||
use Illuminate\Console\Command;
|
||||
use Modules\AI\Models\AIExecution;
|
||||
|
||||
final class PruneAIExecutions extends Command
|
||||
{
|
||||
protected $signature = 'ai:prune {--days=}';
|
||||
|
||||
protected $description = 'Remove old AI execution records.';
|
||||
|
||||
public function handle(): int
|
||||
{
|
||||
$days = (int) ($this->option('days') ?: config('ai.retain_executions_days', 90));
|
||||
$count = AIExecution::where('created_at', '<', now()->subDays($days))->delete();
|
||||
$this->info("Deleted {$count} AI executions.");
|
||||
|
||||
return self::SUCCESS;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user