Skip to content

Commit 93355a9

Browse files
committed
formatting
1 parent 4a9cd83 commit 93355a9

File tree

3 files changed

+13
-12
lines changed

3 files changed

+13
-12
lines changed

src/Database/Database.php

+7-7
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use Utopia\Database\Exception as DatabaseException;
88
use Utopia\Database\Exception\Authorization as AuthorizationException;
99
use Utopia\Database\Exception\Conflict as ConflictException;
10+
use Utopia\Database\Exception\Dependency as DependencyException;
1011
use Utopia\Database\Exception\Duplicate as DuplicateException;
1112
use Utopia\Database\Exception\Limit as LimitException;
1213
use Utopia\Database\Exception\NotFound as NotFoundException;
@@ -15,7 +16,6 @@
1516
use Utopia\Database\Exception\Restricted as RestrictedException;
1617
use Utopia\Database\Exception\Structure as StructureException;
1718
use Utopia\Database\Exception\Timeout as TimeoutException;
18-
use Utopia\Database\Exception\Dependency as DependencyException;
1919
use Utopia\Database\Helpers\ID;
2020
use Utopia\Database\Helpers\Permission;
2121
use Utopia\Database\Helpers\Role;
@@ -2078,11 +2078,11 @@ public function renameAttribute(string $collection, string $old, string $new): b
20782078
$attribute = new Document();
20792079

20802080
foreach ($attributes as $value) {
2081-
if($value->getId() === $old){
2081+
if ($value->getId() === $old) {
20822082
$attribute = $value;
20832083
}
20842084

2085-
if($value->getId() === $new){
2085+
if ($value->getId() === $new) {
20862086
throw new DuplicateException('Attribute name already used');
20872087
}
20882088
}
@@ -2098,10 +2098,10 @@ public function renameAttribute(string $collection, string $old, string $new): b
20982098
$indexAttributes = $index->getAttribute('attributes', []);
20992099

21002100
foreach ($indexAttributes as $key => $indexAttribute) {
2101-
if($indexAttribute === $old){
2102-
// if($attribute->getAttribute('array', false)){
2103-
// throw new DependencyException("Can't rename attribute because of functional index dependency must drop index first.");
2104-
// }
2101+
if ($indexAttribute === $old) {
2102+
// if($attribute->getAttribute('array', false)){
2103+
// throw new DependencyException("Can't rename attribute because of functional index dependency must drop index first.");
2104+
// }
21052105

21062106
$indexAttributes[$key] = $new;
21072107
}

src/Database/Exception/Dependency.php

+3-1
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,6 @@
44

55
use Utopia\Database\Exception;
66

7-
class Dependency extends Exception {}
7+
class Dependency extends Exception
8+
{
9+
}

tests/e2e/Adapter/Base.php

+3-4
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
use Utopia\Database\Exception as DatabaseException;
1313
use Utopia\Database\Exception\Authorization as AuthorizationException;
1414
use Utopia\Database\Exception\Conflict as ConflictException;
15+
use Utopia\Database\Exception\Dependency as DependencyException;
1516
use Utopia\Database\Exception\Duplicate as DuplicateException;
1617
use Utopia\Database\Exception\Limit as LimitException;
1718
use Utopia\Database\Exception\Query as QueryException;
@@ -20,7 +21,6 @@
2021
use Utopia\Database\Exception\Structure as StructureException;
2122
use Utopia\Database\Exception\Timeout as TimeoutException;
2223
use Utopia\Database\Exception\Truncate as TruncateException;
23-
use Utopia\Database\Exception\Dependency as DependencyException;
2424
use Utopia\Database\Helpers\ID;
2525
use Utopia\Database\Helpers\Permission;
2626
use Utopia\Database\Helpers\Role;
@@ -2921,10 +2921,9 @@ public function testArrayAttribute(): void
29212921
$this->assertInstanceOf(DependencyException::class, $e);
29222922
$this->assertEquals("Column 'cards' has a functional index dependency and cannot be dropped or renamed.", $e->getMessage());
29232923
}
2924-
}
2925-
else {
2924+
} else {
29262925
$this->assertTrue($database->renameAttribute($collection, 'cards', 'cards_new'));
2927-
$this->assertTrue($database->deleteAttribute($collection, 'cards'));
2926+
$this->assertTrue($database->deleteAttribute($collection, 'cards_new'));
29282927
}
29292928

29302929
try {

0 commit comments

Comments
 (0)