소스 검색

handle case where message.dateSent is null

Olivier Massot 1 년 전
부모
커밋
e90e2db596
1개의 변경된 파일2개의 추가작업 그리고 2개의 파일을 삭제
  1. 2 2
      src/Service/Cron/Job/CleanDb.php

+ 2 - 2
src/Service/Cron/Job/CleanDb.php

@@ -144,7 +144,7 @@ class CleanDb extends BaseCronJob implements CronjobInterface
         $sql = "DELETE r
                 FROM opentalent.Message m
                 inner join opentalent.ReportMessage r on r.message_id = m.id
-                where m.dateSent < :maxDate and m.isSystem = true and m.id > 0;";
+                where (m.dateSent < :maxDate or (m.dateSent is null and m.createDate < :maxDate)) and m.isSystem = true and m.id > 0;";
 
         $stmt = $this->connection->prepare($sql);
         $purgedReportMessage = $stmt->executeStatement(['maxDate' => $maxDate->format('c')]);
@@ -153,7 +153,7 @@ class CleanDb extends BaseCronJob implements CronjobInterface
 
         $sql = "DELETE
                 FROM opentalent.Message
-                where dateSent < :maxDate and isSystem = true and id > 0;";
+                where (m.dateSent < :maxDate or (m.dateSent is null and m.createDate < :maxDate)) and isSystem = true and id > 0;";
 
         $stmt = $this->connection->prepare($sql);
         $purgedMessage = $stmt->executeStatement(['maxDate' => $maxDate->format('c')]);