From 70aefb421b5168e5d85b9618c99f9cefbf230a2c Mon Sep 17 00:00:00 2001 From: Jan Jakes Date: Mon, 14 Nov 2022 17:02:25 +0100 Subject: [PATCH] Clear error when rerunning migration [MAILPOET-4811] --- mailpoet/lib/Migrator/Store.php | 4 +++- mailpoet/tests/integration/Migrator/MigratorTest.php | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/mailpoet/lib/Migrator/Store.php b/mailpoet/lib/Migrator/Store.php index feb60bf252..73feac675f 100644 --- a/mailpoet/lib/Migrator/Store.php +++ b/mailpoet/lib/Migrator/Store.php @@ -29,7 +29,9 @@ class Store { VALUES (?, current_timestamp()) ON DUPLICATE KEY UPDATE started_at = current_timestamp(), - retries = retries + 1 + completed_at = NULL, + retries = retries + 1, + error = NULL ", [$name]); } diff --git a/mailpoet/tests/integration/Migrator/MigratorTest.php b/mailpoet/tests/integration/Migrator/MigratorTest.php index 41a08e98b9..7ec4f30269 100644 --- a/mailpoet/tests/integration/Migrator/MigratorTest.php +++ b/mailpoet/tests/integration/Migrator/MigratorTest.php @@ -212,7 +212,7 @@ class MigratorTest extends MailPoetTest { $this->assertStringMatchesFormat(self::DATE_TIME_FORMAT, $data['started_at']); $this->assertStringMatchesFormat(self::DATE_TIME_FORMAT, $data['completed_at']); $this->assertSame(1, (int)$data['retries']); - $this->assertSame('test-error', $data['error']); + $this->assertNull($data['error']); } public function testItFailsBrokenMigration(): void {