diff --git a/mailpoet/lib/Entities/ScheduledTaskEntity.php b/mailpoet/lib/Entities/ScheduledTaskEntity.php index c16b16a07e..69372af733 100644 --- a/mailpoet/lib/Entities/ScheduledTaskEntity.php +++ b/mailpoet/lib/Entities/ScheduledTaskEntity.php @@ -20,6 +20,7 @@ use MailPoetVendor\Doctrine\ORM\Mapping as ORM; class ScheduledTaskEntity { const STATUS_COMPLETED = 'completed'; const STATUS_SCHEDULED = 'scheduled'; + const STATUS_CANCELLED = 'cancelled'; const STATUS_PAUSED = 'paused'; const STATUS_INVALID = 'invalid'; const VIRTUAL_STATUS_RUNNING = 'running'; // For historical reasons this is stored as null in DB @@ -59,6 +60,12 @@ class ScheduledTaskEntity { */ private $scheduledAt; + /** + * @ORM\Column(type="datetimetz", nullable=true) + * @var DateTimeInterface|null + */ + private $cancelledAt; + /** * @ORM\Column(type="datetimetz", nullable=true) * @var DateTimeInterface|null @@ -155,6 +162,20 @@ class ScheduledTaskEntity { $this->scheduledAt = $scheduledAt; } + /** + * @return DateTimeInterface|null + */ + public function getCancelledAt() { + return $this->cancelledAt; + } + + /** + * @param DateTimeInterface|null $cancelledAt + */ + public function setCancelledAt($cancelledAt) { + $this->cancelledAt = $cancelledAt; + } + /** * @return DateTimeInterface|null */ diff --git a/mailpoet/lib/Migrations/Db/Migration_20240617_122847_Db.php b/mailpoet/lib/Migrations/Db/Migration_20240617_122847_Db.php new file mode 100644 index 0000000000..4f1feb17dc --- /dev/null +++ b/mailpoet/lib/Migrations/Db/Migration_20240617_122847_Db.php @@ -0,0 +1,21 @@ +getTableName(ScheduledTaskEntity::class); + $newColumn = 'cancelled_at'; + if ($this->columnExists($scheduledTasksTable, $newColumn)) { + return; + } + + $this->connection->executeQuery( + "ALTER TABLE `{$scheduledTasksTable}` + ADD COLUMN `{$newColumn}` TIMESTAMP NULL DEFAULT NULL" + ); + } +}