Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@
"coverage": "./vendor/bin/coverage-check ./tmp/clover.xml 90"
},
"require": {
"php": ">=8.3",
"ext-pdo": "*",
"ext-mbstring": "*",
"php": ">=8.3",
"utopia-php/framework": "0.33.*",
"utopia-php/cache": "0.11.*",
"utopia-php/mongo": "0.3.*"
Expand All @@ -58,8 +58,8 @@
},
"config": {
"allow-plugins": {
"php-http/discovery": false,
"tbachert/spi": false
"php-http/discovery": true,
"tbachert/spi": true
}
}
}
108 changes: 54 additions & 54 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 8 additions & 8 deletions src/Database/Adapter/MariaDB.php
Original file line number Diff line number Diff line change
Expand Up @@ -1654,8 +1654,8 @@ public function deleteDocument(string $collection, string $id): bool
$name = $this->filter($collection);

$sql = "
DELETE FROM {$this->getSQLTable($name)}
WHERE _uid = :_uid
DELETE FROM {$this->getSQLTable($name)}
WHERE _uid = :_uid
";

if ($this->sharedTables) {
Expand Down Expand Up @@ -2394,27 +2394,27 @@ protected function processException(PDOException $e): \Exception
{
// Timeout
if ($e->getCode() === '70100' && isset($e->errorInfo[1]) && $e->errorInfo[1] === 1969) {
return new TimeoutException($e->getMessage(), $e->getCode(), $e);
return new TimeoutException('Query timed out', $e->getCode(), $e);
}

// Duplicate table
if ($e->getCode() === '42S01' && isset($e->errorInfo[1]) && $e->errorInfo[1] === 1050) {
return new DuplicateException($e->getMessage(), $e->getCode(), $e);
return new DuplicateException('Collection already exists', $e->getCode(), $e);
}

// Duplicate column
if ($e->getCode() === '42S21' && isset($e->errorInfo[1]) && $e->errorInfo[1] === 1060) {
return new DuplicateException($e->getMessage(), $e->getCode(), $e);
return new DuplicateException('Attribute already exists', $e->getCode(), $e);
}

// Duplicate index
if ($e->getCode() === '42000' && isset($e->errorInfo[1]) && $e->errorInfo[1] === 1061) {
return new DuplicateException($e->getMessage(), $e->getCode(), $e);
return new DuplicateException('Index already exists', $e->getCode(), $e);
}

// Duplicate row
if ($e->getCode() === '23000' && isset($e->errorInfo[1]) && $e->errorInfo[1] === 1062) {
return new DuplicateException($e->getMessage(), $e->getCode(), $e);
return new DuplicateException('Document already exists', $e->getCode(), $e);
}

// Data is too big for column resize
Expand All @@ -2425,7 +2425,7 @@ protected function processException(PDOException $e): \Exception

// Unknown database
if ($e->getCode() === '42000' && isset($e->errorInfo[1]) && $e->errorInfo[1] === 1049) {
return new NotFoundException($e->getMessage(), $e->getCode(), $e);
return new NotFoundException('Database not found', $e->getCode(), $e);
}

return $e;
Expand Down
2 changes: 1 addition & 1 deletion src/Database/Adapter/Mongo.php
Original file line number Diff line number Diff line change
Expand Up @@ -1934,7 +1934,7 @@ public function getKeywords(): array
protected function processException(Exception $e): \Exception
{
if ($e->getCode() === 50) {
return new Timeout($e->getMessage());
return new Timeout('Query timed out', $e->getCode(), $e);
}

return $e;
Expand Down
4 changes: 2 additions & 2 deletions src/Database/Adapter/MySQL.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,12 @@ protected function processException(PDOException $e): \Exception
{
// Timeout
if ($e->getCode() === 'HY000' && isset($e->errorInfo[1]) && $e->errorInfo[1] === 3024) {
return new TimeoutException($e->getMessage(), $e->getCode(), $e);
return new TimeoutException('Query timed out', $e->getCode(), $e);
}

// Functional index dependency
if ($e->getCode() === 'HY000' && isset($e->errorInfo[1]) && $e->errorInfo[1] === 3837) {
return new DependencyException($e->errorInfo[2], $e->getCode(), $e);
return new DependencyException('Attribute cannot be deleted because it is used in an index', $e->getCode(), $e);
}

return parent::processException($e);
Expand Down
Loading
Loading