diff options
author | Joas Schilling <213943+nickvergessen@users.noreply.github.com> | 2021-03-04 11:05:26 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-04 11:05:26 +0300 |
commit | bfc827a2b71a5e9d95e8ce077333ab81d72a9d67 (patch) | |
tree | 3712cff71e5523b3b964cb9675ce46dbabf15b70 | |
parent | e1be5b1b6f1de8f06a3682a5cb3deb5c30f72142 (diff) | |
parent | f56e55dcf035332b482531fad82bc976ae774172 (diff) |
Merge pull request #5245 from nextcloud/backport/5242/stable20.1
[stable20.1] Try to catch the unique constraint violation on migrating the data
-rw-r--r-- | lib/Migration/Version10000Date20201015134000.php | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/Migration/Version10000Date20201015134000.php b/lib/Migration/Version10000Date20201015134000.php index aa7e5bb5e..cc5fdc7f3 100644 --- a/lib/Migration/Version10000Date20201015134000.php +++ b/lib/Migration/Version10000Date20201015134000.php @@ -26,6 +26,7 @@ declare(strict_types=1); namespace OCA\Talk\Migration; use Closure; +use Doctrine\DBAL\Exception\UniqueConstraintViolationException; use Doctrine\DBAL\Types\Type; use OCA\Talk\Model\Attendee; use OCA\Talk\Participant; @@ -220,7 +221,16 @@ class Version10000Date20201015134000 extends SimpleMigrationStep { ->setParameter('last_mention_message', (int) $row['last_mention_message'], IQueryBuilder::PARAM_INT) ; - $insert->execute(); + try { + $insert->execute(); + } catch (\Exception $e) { + if (get_class($e) === UniqueConstraintViolationException::class) { + // UniqueConstraintViolationException before 21 + continue; + } + + throw $e; + } } $result->closeCursor(); } |