Files
boursecu_server/app/Console/Commands/PrunePriceSnapshotsCommand.php
T

26 lines
680 B
PHP
Raw Normal View History

2026-06-13 17:35:40 +03:30
<?php
namespace App\Console\Commands;
use App\Services\DatabaseLogPruneService;
2026-06-13 17:35:40 +03:30
use App\Services\PriceSnapshotService;
use Illuminate\Console\Command;
class PrunePriceSnapshotsCommand extends Command
{
protected $signature = 'prices:prune';
protected $description = 'Nightly prune: price history + bloating logs (31-day retention)';
2026-06-13 17:35:40 +03:30
public function handle(PriceSnapshotService $snapshots, DatabaseLogPruneService $logs): int
2026-06-13 17:35:40 +03:30
{
$stats = [
'prices' => $snapshots->pruneHistory(),
'logs' => $logs->pruneHistory(),
];
2026-06-13 17:35:40 +03:30
$this->info(json_encode($stats, JSON_UNESCAPED_UNICODE));
return self::SUCCESS;
}
}