Browse Source
Fix migration checking for unique constraint violation
Signed-off-by: Joas Schilling <coding@schilljs.com>
pull/5421/head
Joas Schilling
5 years ago
No known key found for this signature in database
GPG Key ID: 7076EA9751AACDDA
1 changed files with
4 additions and
2 deletions
-
lib/Migration/Version10000Date20201015134000.php
|
|
|
@ -225,12 +225,14 @@ class Version10000Date20201015134000 extends SimpleMigrationStep { |
|
|
|
try { |
|
|
|
$insert->execute(); |
|
|
|
} catch (\Exception $e) { |
|
|
|
if (get_class($e) === UniqueConstraintViolationException::class) { |
|
|
|
if (class_exists(UniqueConstraintViolationException::class) |
|
|
|
&& $e instanceof UniqueConstraintViolationException) { |
|
|
|
// UniqueConstraintViolationException before 21
|
|
|
|
continue; |
|
|
|
} |
|
|
|
|
|
|
|
if (get_class($e) === Exception::class |
|
|
|
if (class_exists(Exception::class) |
|
|
|
&& $e instanceof Exception |
|
|
|
// Exception with 21 and later
|
|
|
|
&& $e->getReason() === Exception::REASON_UNIQUE_CONSTRAINT_VIOLATION) { |
|
|
|
continue; |
|
|
|
|