When deleting old logs Delete oldest logs first
[MAILPOET-5071]
This commit is contained in:
committed by
Aschepikov
parent
6f70cd1651
commit
5fa1ba823b
@ -70,7 +70,8 @@ class LogRepository extends Repository {
|
||||
$logsTable = $this->entityManager->getClassMetadata(LogEntity::class)->getTableName();
|
||||
$this->entityManager->getConnection()->executeStatement("
|
||||
DELETE FROM $logsTable
|
||||
WHERE `created_at` < :date LIMIT :limit
|
||||
WHERE `created_at` < :date
|
||||
ORDER BY `id` ASC LIMIT :limit
|
||||
", [
|
||||
'date' => Carbon::now()->subDays($daysToKeepLogs)->toDateTimeString(),
|
||||
'limit' => $limit,
|
||||
|
Reference in New Issue
Block a user