]> source.dussan.org Git - nextcloud-server.git/commitdiff
Don't try to update on NotNullConstraintViolationException, only on unique or foreign key
authorJoas Schilling <coding@schilljs.com>
Mon, 9 Nov 2020 16:33:32 +0000 (17:33 +0100)
committerJoas Schilling <coding@schilljs.com>
Thu, 12 Nov 2020 11:57:51 +0000 (12:57 +0100)
Signed-off-by: Joas Schilling <coding@schilljs.com>
lib/private/DB/Connection.php

index 17e76c37b3384f21163db02a486140fef4cdf2e4..81b5e4feabfc290bead0dcc33a12a89a9a12b7e4 100644 (file)
@@ -39,6 +39,7 @@ use Doctrine\DBAL\Configuration;
 use Doctrine\DBAL\DBALException;
 use Doctrine\DBAL\Driver;
 use Doctrine\DBAL\Exception\ConstraintViolationException;
+use Doctrine\DBAL\Exception\NotNullConstraintViolationException;
 use Doctrine\DBAL\Platforms\MySqlPlatform;
 use Doctrine\DBAL\Schema\Schema;
 use OC\DB\QueryBuilder\QueryBuilder;
@@ -297,6 +298,8 @@ class Connection extends ReconnectWrapper implements IDBConnection {
                                        }, array_merge($keys, $values))
                                );
                        return $insertQb->execute();
+               } catch (NotNullConstraintViolationException $e) {
+                       throw $e;
                } catch (ConstraintViolationException $e) {
                        // value already exists, try update
                        $updateQb = $this->getQueryBuilder();