From b905af91af8f55071328e46ab59dbeb8ca63eeb0 Mon Sep 17 00:00:00 2001 From: Darshan Date: Mon, 5 May 2025 14:43:09 +0530 Subject: [PATCH 01/10] fix: project usage `documents` to `rows`. --- app/controllers/api/project.php | 2 +- src/Appwrite/Utopia/Response/Model/UsageProject.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/controllers/api/project.php b/app/controllers/api/project.php index 047179b888..97475c743a 100644 --- a/app/controllers/api/project.php +++ b/app/controllers/api/project.php @@ -353,7 +353,7 @@ App::get('/v1/project/usage') 'executionsTotal' => $total[METRIC_EXECUTIONS], 'executionsMbSecondsTotal' => $total[METRIC_EXECUTIONS_MB_SECONDS], 'buildsMbSecondsTotal' => $total[METRIC_BUILDS_MB_SECONDS], - 'documentsTotal' => $total[METRIC_DOCUMENTS], + 'rowsTotal' => $total[METRIC_DOCUMENTS], 'databasesTotal' => $total[METRIC_DATABASES], 'databasesStorageTotal' => $total[METRIC_DATABASES_STORAGE], 'usersTotal' => $total[METRIC_USERS], diff --git a/src/Appwrite/Utopia/Response/Model/UsageProject.php b/src/Appwrite/Utopia/Response/Model/UsageProject.php index 395b19b7cd..b79cd85bed 100644 --- a/src/Appwrite/Utopia/Response/Model/UsageProject.php +++ b/src/Appwrite/Utopia/Response/Model/UsageProject.php @@ -16,9 +16,9 @@ class UsageProject extends Model 'default' => 0, 'example' => 0, ]) - ->addRule('documentsTotal', [ + ->addRule('rowsTotal', [ 'type' => self::TYPE_INTEGER, - 'description' => 'Total aggregated number of documents.', + 'description' => 'Total aggregated number of rows.', 'default' => 0, 'example' => 0, ]) From 67a8f522e5d9ae147807a9fcd8b2c74bdfd08313 Mon Sep 17 00:00:00 2001 From: Darshan Date: Mon, 5 May 2025 14:45:55 +0530 Subject: [PATCH 02/10] fix: project and general usage tests. --- tests/e2e/General/UsageTest.php | 48 +++++++++---------- .../Projects/ProjectsConsoleClientTest.php | 2 +- 2 files changed, 25 insertions(+), 25 deletions(-) diff --git a/tests/e2e/General/UsageTest.php b/tests/e2e/General/UsageTest.php index 5549ef800d..0c27a76311 100644 --- a/tests/e2e/General/UsageTest.php +++ b/tests/e2e/General/UsageTest.php @@ -416,8 +416,8 @@ class UsageTest extends Scope $requestsTotal = $data['requestsTotal']; $databasesTotal = 0; - $collectionsTotal = 0; - $documentsTotal = 0; + $tablesTotal = 0; + $rowsTotal = 0; for ($i = 0; $i < self::CREATE; $i++) { $name = uniqid() . ' database'; @@ -470,7 +470,7 @@ class UsageTest extends Scope 'x-appwrite-project' => $this->getProject()['$id'] ], $this->getHeaders()), [ - 'collectionId' => 'unique()', + 'tableId' => 'unique()', 'name' => $name, 'documentSecurity' => false, 'permissions' => [ @@ -486,7 +486,7 @@ class UsageTest extends Scope $this->assertNotEmpty($response['body']['$id']); $requestsTotal += 1; - $collectionsTotal += 1; + $tablesTotal += 1; $collectionId = $response['body']['$id']; @@ -501,7 +501,7 @@ class UsageTest extends Scope $this->assertEmpty($response['body']); - $collectionsTotal -= 1; + $tablesTotal -= 1; $requestsTotal += 1; } } @@ -546,7 +546,7 @@ class UsageTest extends Scope $this->assertNotEmpty($response['body']['$id']); $requestsTotal += 1; - $documentsTotal += 1; + $rowsTotal += 1; $documentId = $response['body']['$id']; @@ -561,18 +561,18 @@ class UsageTest extends Scope $this->assertEmpty($response['body']); - $documentsTotal -= 1; + $rowsTotal -= 1; $requestsTotal += 1; } } return array_merge($data, [ 'databaseId' => $databaseId, - 'collectionId' => $collectionId, + 'tableId' => $collectionId, 'requestsTotal' => $requestsTotal, 'databasesTotal' => $databasesTotal, - 'collectionsTotal' => $collectionsTotal, - 'documentsTotal' => $documentsTotal, + 'tablesTotal' => $tablesTotal, + 'rowsTotal' => $rowsTotal, ]); } @@ -581,11 +581,11 @@ class UsageTest extends Scope public function testDatabaseStats(array $data): array { $databaseId = $data['databaseId']; - $collectionId = $data['collectionId']; + $collectionId = $data['tableId']; $requestsTotal = $data['requestsTotal']; $databasesTotal = $data['databasesTotal']; - $collectionsTotal = $data['collectionsTotal']; - $documentsTotal = $data['documentsTotal']; + $tablesTotal = $data['tablesTotal']; + $rowsTotal = $data['rowsTotal']; sleep(self::WAIT); @@ -606,7 +606,7 @@ class UsageTest extends Scope $this->assertEquals($requestsTotal, $response['body']['requests'][array_key_last($response['body']['requests'])]['value']); $this->validateDates($response['body']['requests']); $this->assertEquals($databasesTotal, $response['body']['databasesTotal']); - $this->assertEquals($documentsTotal, $response['body']['documentsTotal']); + $this->assertEquals($rowsTotal, $response['body']['rowsTotal']); $response = $this->client->call( Client::METHOD_GET, @@ -616,10 +616,10 @@ class UsageTest extends Scope $this->assertEquals($databasesTotal, $response['body']['databases'][array_key_last($response['body']['databases'])]['value']); $this->validateDates($response['body']['databases']); - $this->assertEquals($collectionsTotal, $response['body']['collections'][array_key_last($response['body']['collections'])]['value']); - $this->validateDates($response['body']['collections']); - $this->assertEquals($documentsTotal, $response['body']['documents'][array_key_last($response['body']['documents'])]['value']); - $this->validateDates($response['body']['documents']); + $this->assertEquals($tablesTotal, $response['body']['tables'][array_key_last($response['body']['tables'])]['value']); + $this->validateDates($response['body']['tables']); + $this->assertEquals($rowsTotal, $response['body']['rows'][array_key_last($response['body']['rows'])]['value']); + $this->validateDates($response['body']['rows']); $response = $this->client->call( Client::METHOD_GET, @@ -627,11 +627,11 @@ class UsageTest extends Scope $this->getConsoleHeaders() ); - $this->assertEquals($collectionsTotal, $response['body']['collections'][array_key_last($response['body']['collections'])]['value']); - $this->validateDates($response['body']['collections']); + $this->assertEquals($tablesTotal, $response['body']['tables'][array_key_last($response['body']['tables'])]['value']); + $this->validateDates($response['body']['tables']); - $this->assertEquals($documentsTotal, $response['body']['documents'][array_key_last($response['body']['documents'])]['value']); - $this->validateDates($response['body']['documents']); + $this->assertEquals($rowsTotal, $response['body']['rows'][array_key_last($response['body']['rows'])]['value']); + $this->validateDates($response['body']['rows']); $response = $this->client->call( Client::METHOD_GET, @@ -639,8 +639,8 @@ class UsageTest extends Scope $this->getConsoleHeaders() ); - $this->assertEquals($documentsTotal, $response['body']['documents'][array_key_last($response['body']['documents'])]['value']); - $this->validateDates($response['body']['documents']); + $this->assertEquals($rowsTotal, $response['body']['rows'][array_key_last($response['body']['rows'])]['value']); + $this->validateDates($response['body']['rows']); return $data; } diff --git a/tests/e2e/Services/Projects/ProjectsConsoleClientTest.php b/tests/e2e/Services/Projects/ProjectsConsoleClientTest.php index c66a581b1a..c864773535 100644 --- a/tests/e2e/Services/Projects/ProjectsConsoleClientTest.php +++ b/tests/e2e/Services/Projects/ProjectsConsoleClientTest.php @@ -483,7 +483,7 @@ class ProjectsConsoleClientTest extends Scope $this->assertIsArray($response['body']['requests']); $this->assertIsArray($response['body']['network']); $this->assertIsNumeric($response['body']['executionsTotal']); - $this->assertIsNumeric($response['body']['documentsTotal']); + $this->assertIsNumeric($response['body']['rowsTotal']); $this->assertIsNumeric($response['body']['databasesTotal']); $this->assertIsNumeric($response['body']['bucketsTotal']); $this->assertIsNumeric($response['body']['usersTotal']); From 565e6b2ad8bfb8fb2685fad630cd5115708e0a70 Mon Sep 17 00:00:00 2001 From: Darshan Date: Mon, 5 May 2025 17:03:17 +0530 Subject: [PATCH 03/10] fix: migrations test <> csv imports. --- tests/e2e/Services/Migrations/MigrationsBase.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/e2e/Services/Migrations/MigrationsBase.php b/tests/e2e/Services/Migrations/MigrationsBase.php index c241b38e3d..208bd58731 100644 --- a/tests/e2e/Services/Migrations/MigrationsBase.php +++ b/tests/e2e/Services/Migrations/MigrationsBase.php @@ -1176,7 +1176,7 @@ trait MigrationsBase ]); $this->assertEquals(200, $documents['headers']['status-code']); - $this->assertIsArray($documents['body']['documents']); + $this->assertIsArray($documents['body']['rows']); $this->assertIsNumeric($documents['body']['total']); $this->assertEquals($documentsCountInCSV, $documents['body']['total']); } From 56077d59f72398369dda3771f23a3f8fb0cd3d31 Mon Sep 17 00:00:00 2001 From: Darshan Date: Tue, 6 May 2025 10:51:11 +0530 Subject: [PATCH 04/10] fix: graphql tests. --- app/init/resources.php | 8 ++-- src/Appwrite/GraphQL/Types/Mapper.php | 26 ++++++------- .../Modules/Databases/Http/Tables/XList.php | 2 +- .../Request/Filters/DatabaseAliases.php | 3 +- tests/e2e/Services/GraphQL/Base.php | 38 +++++++++---------- 5 files changed, 39 insertions(+), 38 deletions(-) diff --git a/app/init/resources.php b/app/init/resources.php index 3a1539e59b..7657b9ea69 100644 --- a/app/init/resources.php +++ b/app/init/resources.php @@ -721,8 +721,8 @@ App::setResource('schema', function ($utopia, $dbForProject) { // Order must be the same as the route params return [ 'databaseId' => $databaseId, - 'documentId' => $id, - 'collectionId' => $collectionId, + 'rowId' => $id, + 'tableId' => $collectionId, 'data' => $args, 'permissions' => $permissions, ]; @@ -737,8 +737,8 @@ App::setResource('schema', function ($utopia, $dbForProject) { // Order must be the same as the route params return [ 'databaseId' => $databaseId, - 'collectionId' => $collectionId, - 'documentId' => $documentId, + 'tableId' => $collectionId, + 'rowId' => $documentId, 'data' => $args, 'permissions' => $permissions, ]; diff --git a/src/Appwrite/GraphQL/Types/Mapper.php b/src/Appwrite/GraphQL/Types/Mapper.php index e5056d0abc..8cfad823af 100644 --- a/src/Appwrite/GraphQL/Types/Mapper.php +++ b/src/Appwrite/GraphQL/Types/Mapper.php @@ -418,8 +418,8 @@ class Mapper // TODO: Find a better way to do this switch ($name) { - case 'Attributes': - return static::getAttributeImplementation($object); + case 'Columns': + return static::getColumnImplementation($object); case 'HashOptions': return static::getHashOptionsImplementation($object); } @@ -427,29 +427,29 @@ class Mapper throw new Exception('Unknown union type: ' . $name); } - private static function getAttributeImplementation(array $object): Type + private static function getColumnImplementation(array $object): Type { switch ($object['type']) { case 'string': return match ($object['format'] ?? '') { - 'email' => static::model('AttributeEmail'), - 'url' => static::model('AttributeUrl'), - 'ip' => static::model('AttributeIp'), - default => static::model('AttributeString'), + 'email' => static::model('ColumnEmail'), + 'url' => static::model('ColumnUrl'), + 'ip' => static::model('ColumnIp'), + default => static::model('ColumnString'), }; case 'integer': - return static::model('AttributeInteger'); + return static::model('ColumnInteger'); case 'double': - return static::model('AttributeFloat'); + return static::model('ColumnFloat'); case 'boolean': - return static::model('AttributeBoolean'); + return static::model('ColumnBoolean'); case 'datetime': - return static::model('AttributeDatetime'); + return static::model('ColumnDatetime'); case 'relationship': - return static::model('AttributeRelationship'); + return static::model('ColumnRelationship'); } - throw new Exception('Unknown attribute implementation'); + throw new Exception('Unknown column implementation'); } private static function getHashOptionsImplementation(array $object): Type diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Tables/XList.php b/src/Appwrite/Platform/Modules/Databases/Http/Tables/XList.php index 86107cc533..055102415d 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Tables/XList.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Tables/XList.php @@ -49,7 +49,7 @@ class XList extends Action responses: [ new SDKResponse( code: SwooleResponse::STATUS_CODE_OK, - model: UtopiaResponse::MODEL_TABLE, + model: UtopiaResponse::MODEL_TABLE_LIST, ) ], contentType: ContentType::JSON diff --git a/src/Appwrite/Utopia/Request/Filters/DatabaseAliases.php b/src/Appwrite/Utopia/Request/Filters/DatabaseAliases.php index b2b772be11..0ee2754475 100644 --- a/src/Appwrite/Utopia/Request/Filters/DatabaseAliases.php +++ b/src/Appwrite/Utopia/Request/Filters/DatabaseAliases.php @@ -12,7 +12,8 @@ class DatabaseAliases extends Filter 'attributes' => 'columns', 'collectionId' => 'tableId', 'attributeId' => 'columnId', - 'relatedCollectionId' => 'relatedTableId' + 'relatedCollection' => 'relatedTable', + 'relatedCollectionId' => 'relatedTableId', ]; public function parse(array $content, string $model): array diff --git a/tests/e2e/Services/GraphQL/Base.php b/tests/e2e/Services/GraphQL/Base.php index 95f446cf6f..7c91cf67f7 100644 --- a/tests/e2e/Services/GraphQL/Base.php +++ b/tests/e2e/Services/GraphQL/Base.php @@ -259,8 +259,8 @@ trait Base // Fragments public static string $FRAGMENT_COLUMNS = ' - fragment attributeProperties on Attributes { - ... on AttributeString { + fragment columnProperties on Columns { + ... on ColumnString { key required array @@ -268,7 +268,7 @@ trait Base default size } - ... on AttributeInteger { + ... on ColumnInteger { key required array @@ -277,7 +277,7 @@ trait Base intMin: min intMax: max } - ... on AttributeFloat { + ... on ColumnFloat { key required array @@ -286,35 +286,35 @@ trait Base floatMin: min floatMax: max } - ... on AttributeBoolean { + ... on ColumnBoolean { key required array status boolDefault:default } - ... on AttributeUrl { + ... on ColumnUrl { key required array status default } - ... on AttributeEmail { + ... on ColumnEmail { key required array status default } - ... on AttributeIp { + ... on ColumnIp { key required array status default } - ... on AttributeEnum { + ... on ColumnEnum { key required array @@ -322,7 +322,7 @@ trait Base default elements } - ... on AttributeDatetime { + ... on ColumnDatetime { key required array @@ -406,7 +406,7 @@ trait Base return 'query listTables($databaseId: String!) { databasesListTables(databaseId: $databaseId) { total - collections { + tables { _id _permissions documentSecurity @@ -527,7 +527,7 @@ trait Base case self::$CREATE_RELATIONSHIP_COLUMN: return 'mutation createRelationshipColumn($databaseId: String!, $tableId: String!, $relatedTableId: String!, $type: String!, $twoWay: Boolean, $key: String, $twoWayKey: String, $onDelete: String){ databasesCreateRelationshipColumn(databaseId: $databaseId, tableId: $tableId, relatedTableId: $relatedTableId, type: $type, twoWay: $twoWay, key: $key, twoWayKey: $twoWayKey, onDelete: $onDelete) { - relatedCollection + relatedTable relationType twoWay key @@ -606,7 +606,7 @@ trait Base case self::$UPDATE_RELATIONSHIP_COLUMN: return 'mutation updateRelationshipColumn($databaseId: String!, $tableId: String!, $key: String!, $onDelete: String){ databasesUpdateRelationshipColumn(databaseId: $databaseId, tableId: $tableId, key: $key, onDelete: $onDelete) { - relatedCollection + relatedTable relationType twoWay key @@ -651,15 +651,15 @@ trait Base return 'query listColumns($databaseId: String!, $tableId: String!) { databasesListColumns(databaseId: $databaseId, tableId: $tableId) { total - attributes { - ...attributeProperties + columns { + ...columnProperties } } }' . PHP_EOL . self::$FRAGMENT_COLUMNS; case self::$GET_COLUMN: return 'query getColumn($databaseId: String!, $tableId: String!, $key: String!) { databasesGetColumn(databaseId: $databaseId, tableId: $tableId, key: $key) { - ...attributeProperties + ...columnProperties } }' . PHP_EOL . self::$FRAGMENT_COLUMNS; case self::$DELETE_COLUMN: @@ -681,7 +681,7 @@ trait Base return 'query listRows($databaseId: String!, $tableId: String!){ databasesListRows(databaseId: $databaseId, tableId: $tableId) { total - documents { + rows { _id _collectionId _permissions @@ -2259,8 +2259,8 @@ trait Base _databaseId name documentSecurity - attributes { - ...attributeProperties + columns { + ...columnProperties } indexes { key From 9e1105b61f71b357adf5871bf57bebc9dff40061 Mon Sep 17 00:00:00 2001 From: Darshan Date: Tue, 6 May 2025 11:29:56 +0530 Subject: [PATCH 05/10] update: tests. --- tests/e2e/General/AbuseTest.php | 16 +- tests/e2e/General/UsageTest.php | 2 +- .../e2e/Services/Databases/DatabasesBase.php | 152 +++++++++--------- .../Databases/DatabasesConsoleClientTest.php | 4 +- .../Databases/DatabasesCustomClientTest.php | 62 +++---- .../Databases/DatabasesCustomServerTest.php | 120 +++++++------- .../DatabasesPermissionsGuestTest.php | 18 +-- .../DatabasesPermissionsMemberTest.php | 12 +- .../DatabasesPermissionsTeamTest.php | 10 +- tests/e2e/Services/GraphQL/AbuseTest.php | 14 +- tests/e2e/Services/GraphQL/Base.php | 8 +- .../Services/Migrations/MigrationsBase.php | 14 +- .../Realtime/RealtimeConsoleClientTest.php | 4 +- .../Realtime/RealtimeCustomClientTest.php | 14 +- tests/e2e/Services/Webhooks/WebhooksBase.php | 12 +- .../Webhooks/WebhooksCustomServerTest.php | 4 +- 16 files changed, 233 insertions(+), 233 deletions(-) diff --git a/tests/e2e/General/AbuseTest.php b/tests/e2e/General/AbuseTest.php index 898fbd4aff..2ef351f43e 100644 --- a/tests/e2e/General/AbuseTest.php +++ b/tests/e2e/General/AbuseTest.php @@ -30,7 +30,7 @@ class AbuseTest extends Scope { $data = $this->createCollection(); $databaseId = $data['databaseId']; - $collectionId = $data['collectionId']; + $collectionId = $data['tableId']; $max = 120; for ($i = 0; $i <= $max + 1; $i++) { @@ -38,7 +38,7 @@ class AbuseTest extends Scope 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], ], [ - 'documentId' => ID::unique(), + 'rowId' => ID::unique(), 'data' => [ 'title' => 'The Hulk ' . $i, ], @@ -56,7 +56,7 @@ class AbuseTest extends Scope { $data = $this->createCollection(); $databaseId = $data['databaseId']; - $collectionId = $data['collectionId']; + $collectionId = $data['tableId']; $max = 120; $document = $this->client->call(Client::METHOD_POST, '/databases/' . $databaseId . '/collections/' . $collectionId . '/documents', [ @@ -64,7 +64,7 @@ class AbuseTest extends Scope 'x-appwrite-project' => $this->getProject()['$id'], 'x-appwrite-key' => $this->getProject()['apiKey'], ], [ - 'documentId' => ID::unique(), + 'rowId' => ID::unique(), 'data' => [ 'title' => 'The Hulk', ], @@ -94,7 +94,7 @@ class AbuseTest extends Scope { $data = $this->createCollection(); $databaseId = $data['databaseId']; - $collectionId = $data['collectionId']; + $collectionId = $data['tableId']; $max = 60; for ($i = 0; $i <= $max + 1; $i++) { @@ -103,7 +103,7 @@ class AbuseTest extends Scope 'x-appwrite-project' => $this->getProject()['$id'], 'x-appwrite-key' => $this->getProject()['apiKey'], ], [ - 'documentId' => ID::unique(), + 'rowId' => ID::unique(), 'data' => [ 'title' => 'The Hulk', ], @@ -232,7 +232,7 @@ class AbuseTest extends Scope 'x-appwrite-project' => $this->getProject()['$id'], 'x-appwrite-key' => $this->getProject()['apiKey'] ], [ - 'collectionId' => ID::unique(), + 'tableId' => ID::unique(), 'name' => 'Movies', 'permissions' => [ Permission::read(Role::any()), @@ -258,7 +258,7 @@ class AbuseTest extends Scope return [ 'databaseId' => $databaseId, - 'collectionId' => $collectionId, + 'tableId' => $collectionId, ]; } diff --git a/tests/e2e/General/UsageTest.php b/tests/e2e/General/UsageTest.php index 0c27a76311..54b8597204 100644 --- a/tests/e2e/General/UsageTest.php +++ b/tests/e2e/General/UsageTest.php @@ -537,7 +537,7 @@ class UsageTest extends Scope 'x-appwrite-project' => $this->getProject()['$id'] ], $this->getHeaders()), [ - 'documentId' => 'unique()', + 'rowId' => 'unique()', 'data' => ['name' => $name] ] ); diff --git a/tests/e2e/Services/Databases/DatabasesBase.php b/tests/e2e/Services/Databases/DatabasesBase.php index 14713a52ee..3df5dd4387 100644 --- a/tests/e2e/Services/Databases/DatabasesBase.php +++ b/tests/e2e/Services/Databases/DatabasesBase.php @@ -51,7 +51,7 @@ trait DatabasesBase 'x-appwrite-project' => $this->getProject()['$id'], 'x-appwrite-key' => $this->getProject()['apiKey'] ]), [ - 'collectionId' => ID::unique(), + 'tableId' => ID::unique(), 'name' => 'Movies', 'documentSecurity' => true, 'permissions' => [ @@ -67,7 +67,7 @@ trait DatabasesBase 'x-appwrite-project' => $this->getProject()['$id'], 'x-appwrite-key' => $this->getProject()['apiKey'] ]), [ - 'collectionId' => ID::unique(), + 'tableId' => ID::unique(), 'name' => 'Actors', 'documentSecurity' => true, 'permissions' => [ @@ -148,7 +148,7 @@ trait DatabasesBase 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], ], $this->getHeaders()), [ - 'documentId' => ID::unique(), + 'rowId' => ID::unique(), 'data' => [ 'title' => 'Captain America', ], @@ -275,7 +275,7 @@ trait DatabasesBase 'x-appwrite-project' => $this->getProject()['$id'], 'x-appwrite-key' => $this->getProject()['apiKey'] ]), [ - 'relatedCollectionId' => $data['actorsId'], + 'relatedTableId' => $data['actorsId'], 'type' => 'oneToMany', 'twoWay' => true, 'key' => 'starringActors', @@ -417,7 +417,7 @@ trait DatabasesBase 'x-appwrite-project' => $this->getProject()['$id'], 'x-appwrite-key' => $this->getProject()['apiKey'] ]), [ - 'collectionId' => ID::unique(), + 'tableId' => ID::unique(), 'name' => 'patch', 'documentSecurity' => true, 'permissions' => [ @@ -488,7 +488,7 @@ trait DatabasesBase 'x-appwrite-project' => $this->getProject()['$id'], 'x-appwrite-key' => $this->getProject()['apiKey'] ]), [ - 'collectionId' => ID::unique(), + 'tableId' => ID::unique(), 'name' => 'Players', 'documentSecurity' => true, 'permissions' => [ @@ -540,7 +540,7 @@ trait DatabasesBase 'x-appwrite-project' => $this->getProject()['$id'], 'x-appwrite-key' => $this->getProject()['apiKey'] ]), [ - 'collectionId' => ID::unique(), + 'tableId' => ID::unique(), 'name' => 'Response Models', // 'permissions' missing on purpose to make sure it's optional 'documentSecurity' => true, @@ -654,7 +654,7 @@ trait DatabasesBase 'x-appwrite-project' => $this->getProject()['$id'], 'x-appwrite-key' => $this->getProject()['apiKey'] ]), [ - 'relatedCollectionId' => $data['actorsId'], + 'relatedTableId' => $data['actorsId'], 'type' => 'oneToMany', 'twoWay' => true, 'key' => 'relationship', @@ -1463,7 +1463,7 @@ trait DatabasesBase 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], ], $this->getHeaders()), [ - 'documentId' => ID::unique(), + 'rowId' => ID::unique(), 'data' => [ 'title' => 'Captain America', 'releaseYear' => 1944, @@ -1484,7 +1484,7 @@ trait DatabasesBase 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], ], $this->getHeaders()), [ - 'documentId' => ID::unique(), + 'rowId' => ID::unique(), 'data' => [ 'title' => 'Spider-Man: Far From Home', 'releaseYear' => 2019, @@ -1507,7 +1507,7 @@ trait DatabasesBase 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], ], $this->getHeaders()), [ - 'documentId' => ID::unique(), + 'rowId' => ID::unique(), 'data' => [ 'title' => 'Spider-Man: Homecoming', 'releaseYear' => 2017, @@ -1530,7 +1530,7 @@ trait DatabasesBase 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], ], $this->getHeaders()), [ - 'documentId' => ID::unique(), + 'rowId' => ID::unique(), 'data' => [ 'releaseYear' => 2020, // Missing title, expect an 400 error ], @@ -1655,7 +1655,7 @@ trait DatabasesBase 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], ], $this->getHeaders()), [ - 'documentId' => ID::unique(), + 'rowId' => ID::unique(), 'data' => [ 'title' => 'Dummy', 'releaseYear' => 1944, @@ -2287,7 +2287,7 @@ trait DatabasesBase 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], ], $this->getHeaders()), [ - 'documentId' => ID::unique(), + 'rowId' => ID::unique(), 'data' => [ 'title' => 'Thor: Ragnaroc', 'releaseYear' => 2017, @@ -2413,7 +2413,7 @@ trait DatabasesBase 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], ], $this->getHeaders()), [ - 'documentId' => ID::unique(), + 'rowId' => ID::unique(), 'data' => [ 'title' => 'Thor: Ragnarok', 'releaseYear' => 2017, @@ -2474,7 +2474,7 @@ trait DatabasesBase 'x-appwrite-project' => $this->getProject()['$id'], 'x-appwrite-key' => $this->getProject()['apiKey'] ]), [ - 'collectionId' => ID::unique(), + 'tableId' => ID::unique(), 'name' => 'invalidDocumentStructure', 'permissions' => [ Permission::create(Role::any()), @@ -2692,7 +2692,7 @@ trait DatabasesBase 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], ], $this->getHeaders()), [ - 'documentId' => ID::unique(), + 'rowId' => ID::unique(), 'data' => [ 'email' => 'user@example.com', ], @@ -2707,7 +2707,7 @@ trait DatabasesBase 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], ], $this->getHeaders()), [ - 'documentId' => ID::unique(), + 'rowId' => ID::unique(), 'data' => [ 'enum' => 'yes', ], @@ -2722,7 +2722,7 @@ trait DatabasesBase 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], ], $this->getHeaders()), [ - 'documentId' => ID::unique(), + 'rowId' => ID::unique(), 'data' => [ 'ip' => '1.1.1.1', ], @@ -2737,7 +2737,7 @@ trait DatabasesBase 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], ], $this->getHeaders()), [ - 'documentId' => ID::unique(), + 'rowId' => ID::unique(), 'data' => [ 'url' => 'http://www.example.com', ], @@ -2752,7 +2752,7 @@ trait DatabasesBase 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], ], $this->getHeaders()), [ - 'documentId' => ID::unique(), + 'rowId' => ID::unique(), 'data' => [ 'range' => 3, ], @@ -2767,7 +2767,7 @@ trait DatabasesBase 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], ], $this->getHeaders()), [ - 'documentId' => ID::unique(), + 'rowId' => ID::unique(), 'data' => [ 'floatRange' => 1.4, ], @@ -2782,7 +2782,7 @@ trait DatabasesBase 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], ], $this->getHeaders()), [ - 'documentId' => ID::unique(), + 'rowId' => ID::unique(), 'data' => [ 'probability' => 0.99999, ], @@ -2797,7 +2797,7 @@ trait DatabasesBase 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], ], $this->getHeaders()), [ - 'documentId' => ID::unique(), + 'rowId' => ID::unique(), 'data' => [ 'upperBound' => 8, ], @@ -2812,7 +2812,7 @@ trait DatabasesBase 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], ], $this->getHeaders()), [ - 'documentId' => ID::unique(), + 'rowId' => ID::unique(), 'data' => [ 'lowerBound' => 8, ], @@ -2841,7 +2841,7 @@ trait DatabasesBase 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], ], $this->getHeaders()), [ - 'documentId' => ID::unique(), + 'rowId' => ID::unique(), 'data' => [ 'email' => 'user@@example.com', ], @@ -2856,7 +2856,7 @@ trait DatabasesBase 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], ], $this->getHeaders()), [ - 'documentId' => ID::unique(), + 'rowId' => ID::unique(), 'data' => [ 'enum' => 'badEnum', ], @@ -2871,7 +2871,7 @@ trait DatabasesBase 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], ], $this->getHeaders()), [ - 'documentId' => ID::unique(), + 'rowId' => ID::unique(), 'data' => [ 'ip' => '1.1.1.1.1', ], @@ -2886,7 +2886,7 @@ trait DatabasesBase 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], ], $this->getHeaders()), [ - 'documentId' => ID::unique(), + 'rowId' => ID::unique(), 'data' => [ 'url' => 'example...com', ], @@ -2901,7 +2901,7 @@ trait DatabasesBase 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], ], $this->getHeaders()), [ - 'documentId' => ID::unique(), + 'rowId' => ID::unique(), 'data' => [ 'range' => 11, ], @@ -2916,7 +2916,7 @@ trait DatabasesBase 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], ], $this->getHeaders()), [ - 'documentId' => ID::unique(), + 'rowId' => ID::unique(), 'data' => [ 'floatRange' => 2.5, ], @@ -2931,7 +2931,7 @@ trait DatabasesBase 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], ], $this->getHeaders()), [ - 'documentId' => ID::unique(), + 'rowId' => ID::unique(), 'data' => [ 'probability' => 1.1, ], @@ -2946,7 +2946,7 @@ trait DatabasesBase 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], ], $this->getHeaders()), [ - 'documentId' => ID::unique(), + 'rowId' => ID::unique(), 'data' => [ 'upperBound' => 11, ], @@ -2961,7 +2961,7 @@ trait DatabasesBase 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], ], $this->getHeaders()), [ - 'documentId' => ID::unique(), + 'rowId' => ID::unique(), 'data' => [ 'lowerBound' => 3, ], @@ -2976,7 +2976,7 @@ trait DatabasesBase 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], ], $this->getHeaders()), [ - 'documentId' => 'unique()', + 'rowId' => 'unique()', 'data' => [ 'birthDay' => '2020-10-10 27:30:10+01:00', ], @@ -3015,7 +3015,7 @@ trait DatabasesBase 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], ], $this->getHeaders()), [ - 'documentId' => ID::unique(), + 'rowId' => ID::unique(), 'data' => [ 'title' => 'Captain America', 'releaseYear' => 1944, @@ -3145,7 +3145,7 @@ trait DatabasesBase 'x-appwrite-project' => $this->getProject()['$id'], 'x-appwrite-key' => $this->getProject()['apiKey'] ]), [ - 'collectionId' => ID::unique(), + 'tableId' => ID::unique(), 'name' => 'enforceCollectionAndDocumentPermissions', 'documentSecurity' => true, 'permissions' => [ @@ -3200,7 +3200,7 @@ trait DatabasesBase 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], ], $this->getHeaders()), [ - 'documentId' => ID::unique(), + 'rowId' => ID::unique(), 'data' => [ 'attribute' => 'one', ], @@ -3217,7 +3217,7 @@ trait DatabasesBase 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], ], $this->getHeaders()), [ - 'documentId' => ID::unique(), + 'rowId' => ID::unique(), 'data' => [ 'attribute' => 'one', ], @@ -3234,7 +3234,7 @@ trait DatabasesBase 'x-appwrite-project' => $this->getProject()['$id'], 'x-appwrite-key' => $this->getProject()['apiKey'] ], [ - 'documentId' => ID::unique(), + 'rowId' => ID::unique(), 'data' => [ 'attribute' => 'one', ], @@ -3338,7 +3338,7 @@ trait DatabasesBase 'x-appwrite-project' => $this->getProject()['$id'], 'x-appwrite-key' => $this->getProject()['apiKey'] ]), [ - 'collectionId' => ID::unique(), + 'tableId' => ID::unique(), 'name' => 'enforceCollectionPermissions', 'permissions' => [ Permission::read(Role::user($user)), @@ -3388,7 +3388,7 @@ trait DatabasesBase 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], ], $this->getHeaders()), [ - 'documentId' => ID::unique(), + 'rowId' => ID::unique(), 'data' => [ 'attribute' => 'one', ], @@ -3405,7 +3405,7 @@ trait DatabasesBase 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], ], $this->getHeaders()), [ - 'documentId' => ID::unique(), + 'rowId' => ID::unique(), 'data' => [ 'attribute' => 'one', ], @@ -3422,7 +3422,7 @@ trait DatabasesBase 'x-appwrite-project' => $this->getProject()['$id'], 'x-appwrite-key' => $this->getProject()['apiKey'] ], [ - 'documentId' => ID::unique(), + 'rowId' => ID::unique(), 'data' => [ 'attribute' => 'one', ], @@ -3541,7 +3541,7 @@ trait DatabasesBase 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], ], $this->getHeaders()), [ - 'documentId' => ID::unique(), + 'rowId' => ID::unique(), 'data' => [ 'title' => 'Captain America', 'releaseYear' => 1944, @@ -3564,7 +3564,7 @@ trait DatabasesBase 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], ], $this->getHeaders()), [ - 'documentId' => ID::unique(), + 'rowId' => ID::unique(), 'data' => [ 'title' => 'Captain America 5', 'releaseYear' => 1944, @@ -3587,7 +3587,7 @@ trait DatabasesBase 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], ], $this->getHeaders()), [ - 'documentId' => ID::unique(), + 'rowId' => ID::unique(), 'data' => [ 'title' => 'Captain America', 'releaseYear' => 1944, @@ -3623,7 +3623,7 @@ trait DatabasesBase ]; $document = $this->client->call(Client::METHOD_POST, '/databases/' . $data['databaseId'] . '/collections/' . $data['moviesId'] . '/documents', $headers, [ - 'documentId' => ID::unique(), + 'rowId' => ID::unique(), 'data' => [ 'title' => 'Creation Date Test', 'releaseYear' => 2000 @@ -3691,7 +3691,7 @@ trait DatabasesBase 'x-appwrite-project' => $this->getProject()['$id'], 'x-appwrite-key' => $this->getProject()['apiKey'] ]), [ - 'collectionId' => ID::unique(), + 'tableId' => ID::unique(), 'name' => 'Movies', 'permissions' => [ Permission::create(Role::user(ID::custom($this->getUser()['$id']))), @@ -3728,7 +3728,7 @@ trait DatabasesBase 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], ], $this->getHeaders()), [ - 'documentId' => ID::unique(), + 'rowId' => ID::unique(), 'data' => [ 'title' => 'Captain America', ], @@ -3802,7 +3802,7 @@ trait DatabasesBase 'x-appwrite-project' => $this->getProject()['$id'], 'x-appwrite-key' => $this->getProject()['apiKey'] ]), [ - 'collectionId' => ID::unique(), + 'tableId' => ID::unique(), 'name' => 'Boolean' ]); @@ -3847,7 +3847,7 @@ trait DatabasesBase 'x-appwrite-project' => $this->getProject()['$id'], 'x-appwrite-key' => $this->getProject()['apiKey'] ]), [ - 'collectionId' => 'person', + 'tableId' => 'person', 'name' => 'person', 'permissions' => [ Permission::read(Role::user($this->getUser()['$id'])), @@ -3865,7 +3865,7 @@ trait DatabasesBase 'x-appwrite-project' => $this->getProject()['$id'], 'x-appwrite-key' => $this->getProject()['apiKey'] ]), [ - 'collectionId' => 'library', + 'tableId' => 'library', 'name' => 'library', 'permissions' => [ Permission::read(Role::user($this->getUser()['$id'])), @@ -3894,7 +3894,7 @@ trait DatabasesBase 'x-appwrite-project' => $this->getProject()['$id'], 'x-appwrite-key' => $this->getProject()['apiKey'] ]), [ - 'relatedCollectionId' => 'library', + 'relatedTableId' => 'library', 'type' => Database::RELATION_ONE_TO_ONE, 'key' => 'library', 'twoWay' => true, @@ -3957,7 +3957,7 @@ trait DatabasesBase 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], ], $this->getHeaders()), [ - 'documentId' => ID::unique(), + 'rowId' => ID::unique(), 'data' => [ 'library' => [ '$id' => 'library1', @@ -3981,7 +3981,7 @@ trait DatabasesBase 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], ], $this->getHeaders()), [ - 'documentId' => ID::unique(), + 'rowId' => ID::unique(), 'data' => [ 'library' => [ 'libraryName' => 'Library 2', @@ -4092,7 +4092,7 @@ trait DatabasesBase 'x-appwrite-project' => $this->getProject()['$id'], 'x-appwrite-key' => $this->getProject()['apiKey'] ]), [ - 'relatedCollectionId' => 'library', + 'relatedTableId' => 'library', 'type' => Database::RELATION_ONE_TO_MANY, 'twoWay' => true, 'key' => 'libraries', @@ -4141,7 +4141,7 @@ trait DatabasesBase 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], ], $this->getHeaders()), [ - 'documentId' => 'person10', + 'rowId' => 'person10', 'data' => [ 'fullName' => 'Stevie Wonder', 'libraries' => [ @@ -4237,7 +4237,7 @@ trait DatabasesBase 'x-appwrite-project' => $this->getProject()['$id'], 'x-appwrite-key' => $this->getProject()['apiKey'] ]), [ - 'collectionId' => ID::unique(), + 'tableId' => ID::unique(), 'name' => 'Albums', 'documentSecurity' => true, 'permissions' => [ @@ -4263,7 +4263,7 @@ trait DatabasesBase 'x-appwrite-project' => $this->getProject()['$id'], 'x-appwrite-key' => $this->getProject()['apiKey'] ]), [ - 'collectionId' => ID::unique(), + 'tableId' => ID::unique(), 'name' => 'Artists', 'documentSecurity' => true, 'permissions' => [ @@ -4289,7 +4289,7 @@ trait DatabasesBase 'x-appwrite-project' => $this->getProject()['$id'], 'x-appwrite-key' => $this->getProject()['apiKey'] ]), [ - 'relatedCollectionId' => $artists['body']['$id'], + 'relatedTableId' => $artists['body']['$id'], 'type' => Database::RELATION_MANY_TO_ONE, 'twoWay' => true, 'key' => 'artist', @@ -4318,7 +4318,7 @@ trait DatabasesBase 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], ], $this->getHeaders()), [ - 'documentId' => 'album1', + 'rowId' => 'album1', 'permissions' => $permissions, 'data' => [ 'name' => 'Album 1', @@ -4381,7 +4381,7 @@ trait DatabasesBase 'x-appwrite-project' => $this->getProject()['$id'], 'x-appwrite-key' => $this->getProject()['apiKey'] ]), [ - 'collectionId' => ID::unique(), + 'tableId' => ID::unique(), 'name' => 'Sports', 'documentSecurity' => true, 'permissions' => [ @@ -4407,7 +4407,7 @@ trait DatabasesBase 'x-appwrite-project' => $this->getProject()['$id'], 'x-appwrite-key' => $this->getProject()['apiKey'] ]), [ - 'collectionId' => ID::unique(), + 'tableId' => ID::unique(), 'name' => 'Players', 'documentSecurity' => true, 'permissions' => [ @@ -4433,7 +4433,7 @@ trait DatabasesBase 'x-appwrite-project' => $this->getProject()['$id'], 'x-appwrite-key' => $this->getProject()['apiKey'] ]), [ - 'relatedCollectionId' => $players['body']['$id'], + 'relatedTableId' => $players['body']['$id'], 'type' => Database::RELATION_MANY_TO_MANY, 'twoWay' => true, 'key' => 'players', @@ -4463,7 +4463,7 @@ trait DatabasesBase 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], ], $this->getHeaders()), [ - 'documentId' => 'sport1', + 'rowId' => 'sport1', 'permissions' => $permissions, 'data' => [ 'name' => 'Sport 1', @@ -4641,7 +4641,7 @@ trait DatabasesBase 'x-appwrite-project' => $this->getProject()['$id'], 'x-appwrite-key' => $this->getProject()['apiKey'] ]), [ - 'collectionId' => ID::unique(), + 'tableId' => ID::unique(), 'name' => 'USA Presidents', 'documentSecurity' => true, 'permissions' => [ @@ -4683,7 +4683,7 @@ trait DatabasesBase 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], ], $this->getHeaders()), [ - 'documentId' => ID::unique(), + 'rowId' => ID::unique(), 'data' => [ 'first_name' => 'Donald', 'last_name' => 'Trump', @@ -4698,7 +4698,7 @@ trait DatabasesBase 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], ], $this->getHeaders()), [ - 'documentId' => ID::unique(), + 'rowId' => ID::unique(), 'data' => [ 'first_name' => 'George', 'last_name' => 'Bush', @@ -4713,7 +4713,7 @@ trait DatabasesBase 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], ], $this->getHeaders()), [ - 'documentId' => ID::unique(), + 'rowId' => ID::unique(), 'data' => [ 'first_name' => 'Joe', 'last_name' => 'Biden', @@ -4764,7 +4764,7 @@ trait DatabasesBase 'x-appwrite-project' => $this->getProject()['$id'], 'x-appwrite-key' => $this->getProject()['apiKey'] ]), [ - 'collectionId' => ID::unique(), + 'tableId' => ID::unique(), 'name' => 'Collection1', 'documentSecurity' => true, 'permissions' => [ @@ -4778,7 +4778,7 @@ trait DatabasesBase 'x-appwrite-project' => $this->getProject()['$id'], 'x-appwrite-key' => $this->getProject()['apiKey'] ]), [ - 'collectionId' => ID::unique(), + 'tableId' => ID::unique(), 'name' => 'Collection2', 'documentSecurity' => true, 'permissions' => [ @@ -4815,7 +4815,7 @@ trait DatabasesBase 'x-appwrite-project' => $this->getProject()['$id'], 'x-appwrite-key' => $this->getProject()['apiKey'] ]), [ - 'relatedCollectionId' => $collection2, + 'relatedTableId' => $collection2, 'type' => Database::RELATION_ONE_TO_MANY, 'twoWay' => true, 'key' => 'collection2' @@ -4827,7 +4827,7 @@ trait DatabasesBase 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'] ], $this->getHeaders()), [ - 'documentId' => ID::unique(), + 'rowId' => ID::unique(), 'data' => [ 'name' => 'Document 1', 'collection2' => [ @@ -4860,7 +4860,7 @@ trait DatabasesBase 'x-appwrite-project' => $this->getProject()['$id'], 'x-appwrite-key' => $this->getProject()['apiKey'] ]), [ - 'collectionId' => ID::unique(), + 'tableId' => ID::unique(), 'name' => 'Slow Queries', 'documentSecurity' => true, 'permissions' => [ @@ -4893,7 +4893,7 @@ trait DatabasesBase 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], ], $this->getHeaders()), [ - 'documentId' => ID::unique(), + 'rowId' => ID::unique(), 'data' => [ 'longtext' => file_get_contents(__DIR__ . '/../../../resources/longtext.txt'), ], diff --git a/tests/e2e/Services/Databases/DatabasesConsoleClientTest.php b/tests/e2e/Services/Databases/DatabasesConsoleClientTest.php index 04daddd47a..e9dca1d674 100644 --- a/tests/e2e/Services/Databases/DatabasesConsoleClientTest.php +++ b/tests/e2e/Services/Databases/DatabasesConsoleClientTest.php @@ -38,7 +38,7 @@ class DatabasesConsoleClientTest extends Scope 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], ], $this->getHeaders()), [ - 'collectionId' => ID::unique(), + 'tableId' => ID::unique(), 'name' => 'Movies', 'permissions' => [ Permission::read(Role::any()), @@ -69,7 +69,7 @@ class DatabasesConsoleClientTest extends Scope 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], ], $this->getHeaders()), [ - 'collectionId' => ID::unique(), + 'tableId' => ID::unique(), 'name' => 'TvShows', 'permissions' => [ Permission::read(Role::any()), diff --git a/tests/e2e/Services/Databases/DatabasesCustomClientTest.php b/tests/e2e/Services/Databases/DatabasesCustomClientTest.php index 6caeb3ca8b..b192cd04a1 100644 --- a/tests/e2e/Services/Databases/DatabasesCustomClientTest.php +++ b/tests/e2e/Services/Databases/DatabasesCustomClientTest.php @@ -40,7 +40,7 @@ class DatabasesCustomClientTest extends Scope 'x-appwrite-project' => $this->getProject()['$id'], 'x-appwrite-key' => $this->getProject()['apiKey'] ]), [ - 'collectionId' => ID::unique(), + 'tableId' => ID::unique(), 'name' => 'Movies', 'documentSecurity' => true, 'permissions' => [ @@ -73,7 +73,7 @@ class DatabasesCustomClientTest extends Scope 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], ], $this->getHeaders()), [ - 'documentId' => ID::unique(), + 'rowId' => ID::unique(), 'data' => [ 'title' => 'Captain America', ], @@ -95,7 +95,7 @@ class DatabasesCustomClientTest extends Scope 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], ], $this->getHeaders()), [ - 'documentId' => ID::unique(), + 'rowId' => ID::unique(), 'data' => [ 'title' => 'Captain America', ], @@ -138,7 +138,7 @@ class DatabasesCustomClientTest extends Scope 'x-appwrite-project' => $this->getProject()['$id'], 'x-appwrite-key' => $this->getProject()['apiKey'] ]), [ - 'collectionId' => ID::custom('permissionCheck'), + 'tableId' => ID::custom('permissionCheck'), 'name' => 'permissionCheck', 'permissions' => [], 'documentSecurity' => true, @@ -166,7 +166,7 @@ class DatabasesCustomClientTest extends Scope 'x-appwrite-project' => $this->getProject()['$id'], 'x-appwrite-key' => $this->getProject()['apiKey'] ]), [ - 'documentId' => ID::custom('permissionCheckDocument'), + 'rowId' => ID::custom('permissionCheckDocument'), 'data' => [ 'name' => 'AppwriteBeginner', ], @@ -247,7 +247,7 @@ class DatabasesCustomClientTest extends Scope 'x-appwrite-project' => $this->getProject()['$id'], 'x-appwrite-key' => $this->getProject()['apiKey'] ]), [ - 'collectionId' => ID::unique(), + 'tableId' => ID::unique(), 'name' => 'level1', 'documentSecurity' => false, 'permissions' => [ @@ -264,7 +264,7 @@ class DatabasesCustomClientTest extends Scope 'x-appwrite-project' => $this->getProject()['$id'], 'x-appwrite-key' => $this->getProject()['apiKey'] ]), [ - 'collectionId' => ID::unique(), + 'tableId' => ID::unique(), 'name' => 'level2', 'documentSecurity' => false, 'permissions' => [ @@ -283,7 +283,7 @@ class DatabasesCustomClientTest extends Scope 'x-appwrite-project' => $this->getProject()['$id'], 'x-appwrite-key' => $this->getProject()['apiKey'] ]), [ - 'relatedCollectionId' => $collection2['body']['$id'], + 'relatedTableId' => $collection2['body']['$id'], 'type' => 'oneToMany', 'twoWay' => true, 'onDelete' => 'cascade', @@ -335,7 +335,7 @@ class DatabasesCustomClientTest extends Scope 'x-appwrite-project' => $this->getProject()['$id'], 'x-appwrite-key' => $this->getProject()['apiKey'] ]), [ - 'collectionId' => ID::unique(), + 'tableId' => ID::unique(), 'name' => 'c1', 'documentSecurity' => false, 'permissions' => [ @@ -351,7 +351,7 @@ class DatabasesCustomClientTest extends Scope 'x-appwrite-project' => $this->getProject()['$id'], 'x-appwrite-key' => $this->getProject()['apiKey'] ]), [ - 'collectionId' => ID::unique(), + 'tableId' => ID::unique(), 'name' => 'c2', 'documentSecurity' => false, 'permissions' => [ @@ -369,7 +369,7 @@ class DatabasesCustomClientTest extends Scope 'x-appwrite-project' => $this->getProject()['$id'], 'x-appwrite-key' => $this->getProject()['apiKey'] ]), [ - 'relatedCollectionId' => $collection2['body']['$id'], + 'relatedTableId' => $collection2['body']['$id'], 'type' => Database::RELATION_ONE_TO_ONE, 'twoWay' => false, 'onDelete' => 'cascade', @@ -387,7 +387,7 @@ class DatabasesCustomClientTest extends Scope 'x-appwrite-project' => $this->getProject()['$id'], 'x-appwrite-key' => $this->getProject()['apiKey'] ]), [ - 'relatedCollectionId' => $collection2['body']['$id'], + 'relatedTableId' => $collection2['body']['$id'], 'type' => Database::RELATION_ONE_TO_MANY, 'twoWay' => false, 'onDelete' => 'cascade', @@ -406,7 +406,7 @@ class DatabasesCustomClientTest extends Scope 'x-appwrite-project' => $this->getProject()['$id'], 'x-appwrite-key' => $this->getProject()['apiKey'] ]), [ - 'relatedCollectionId' => $collection2['body']['$id'], + 'relatedTableId' => $collection2['body']['$id'], 'type' => Database::RELATION_ONE_TO_MANY, 'twoWay' => false, 'onDelete' => 'cascade', @@ -424,7 +424,7 @@ class DatabasesCustomClientTest extends Scope 'x-appwrite-project' => $this->getProject()['$id'], 'x-appwrite-key' => $this->getProject()['apiKey'] ]), [ - 'relatedCollectionId' => $collection2['body']['$id'], + 'relatedTableId' => $collection2['body']['$id'], 'type' => Database::RELATION_ONE_TO_MANY, 'twoWay' => false, 'onDelete' => 'cascade', @@ -442,7 +442,7 @@ class DatabasesCustomClientTest extends Scope 'x-appwrite-project' => $this->getProject()['$id'], 'x-appwrite-key' => $this->getProject()['apiKey'] ]), [ - 'relatedCollectionId' => $collection2['body']['$id'], + 'relatedTableId' => $collection2['body']['$id'], 'type' => Database::RELATION_MANY_TO_MANY, 'twoWay' => true, 'onDelete' => 'setNull', @@ -461,7 +461,7 @@ class DatabasesCustomClientTest extends Scope 'x-appwrite-project' => $this->getProject()['$id'], 'x-appwrite-key' => $this->getProject()['apiKey'] ]), [ - 'relatedCollectionId' => $collection2['body']['$id'], + 'relatedTableId' => $collection2['body']['$id'], 'type' => Database::RELATION_MANY_TO_MANY, 'twoWay' => true, 'onDelete' => 'setNull', @@ -495,7 +495,7 @@ class DatabasesCustomClientTest extends Scope 'x-appwrite-project' => $this->getProject()['$id'], 'x-appwrite-key' => $this->getProject()['apiKey'] ]), [ - 'collectionId' => ID::custom('collection1'), + 'tableId' => ID::custom('collection1'), 'name' => ID::custom('collection1'), 'documentSecurity' => false, 'permissions' => [ @@ -511,7 +511,7 @@ class DatabasesCustomClientTest extends Scope 'x-appwrite-project' => $this->getProject()['$id'], 'x-appwrite-key' => $this->getProject()['apiKey'] ]), [ - 'collectionId' => ID::custom('collection2'), + 'tableId' => ID::custom('collection2'), 'name' => ID::custom('collection2'), 'documentSecurity' => false, 'permissions' => [ @@ -524,7 +524,7 @@ class DatabasesCustomClientTest extends Scope 'x-appwrite-project' => $this->getProject()['$id'], 'x-appwrite-key' => $this->getProject()['apiKey'] ]), [ - 'collectionId' => ID::custom('collection3'), + 'tableId' => ID::custom('collection3'), 'name' => ID::custom('collection3'), 'documentSecurity' => false, 'permissions' => [ @@ -539,7 +539,7 @@ class DatabasesCustomClientTest extends Scope 'x-appwrite-project' => $this->getProject()['$id'], 'x-appwrite-key' => $this->getProject()['apiKey'] ]), [ - 'collectionId' => ID::custom('collection4'), + 'tableId' => ID::custom('collection4'), 'name' => ID::custom('collection4'), 'documentSecurity' => false, 'permissions' => [ @@ -552,7 +552,7 @@ class DatabasesCustomClientTest extends Scope 'x-appwrite-project' => $this->getProject()['$id'], 'x-appwrite-key' => $this->getProject()['apiKey'] ]), [ - 'collectionId' => ID::custom('collection5'), + 'tableId' => ID::custom('collection5'), 'name' => ID::custom('collection5'), 'documentSecurity' => false, 'permissions' => [ @@ -568,7 +568,7 @@ class DatabasesCustomClientTest extends Scope 'x-appwrite-project' => $this->getProject()['$id'], 'x-appwrite-key' => $this->getProject()['apiKey'] ]), [ - 'relatedCollectionId' => $collection2['body']['$id'], + 'relatedTableId' => $collection2['body']['$id'], 'type' => 'oneToOne', 'twoWay' => false, 'onDelete' => 'setNull', @@ -581,7 +581,7 @@ class DatabasesCustomClientTest extends Scope 'x-appwrite-project' => $this->getProject()['$id'], 'x-appwrite-key' => $this->getProject()['apiKey'] ]), [ - 'relatedCollectionId' => $collection3['body']['$id'], + 'relatedTableId' => $collection3['body']['$id'], 'type' => 'oneToOne', 'twoWay' => false, 'onDelete' => 'setNull', @@ -594,7 +594,7 @@ class DatabasesCustomClientTest extends Scope 'x-appwrite-project' => $this->getProject()['$id'], 'x-appwrite-key' => $this->getProject()['apiKey'] ]), [ - 'relatedCollectionId' => $collection4['body']['$id'], + 'relatedTableId' => $collection4['body']['$id'], 'type' => 'oneToOne', 'twoWay' => false, 'onDelete' => 'setNull', @@ -607,7 +607,7 @@ class DatabasesCustomClientTest extends Scope 'x-appwrite-project' => $this->getProject()['$id'], 'x-appwrite-key' => $this->getProject()['apiKey'] ]), [ - 'relatedCollectionId' => $collection5['body']['$id'], + 'relatedTableId' => $collection5['body']['$id'], 'type' => 'oneToOne', 'twoWay' => false, 'onDelete' => 'setNull', @@ -681,7 +681,7 @@ class DatabasesCustomClientTest extends Scope 'x-appwrite-project' => $this->getProject()['$id'], 'x-appwrite-key' => $this->getProject()['apiKey'] ]), [ - 'documentId' => ID::custom($collection1['body']['$id']), + 'rowId' => ID::custom($collection1['body']['$id']), 'data' => [ 'Title' => 'Captain America', $collection2['body']['$id'] => [ @@ -709,7 +709,7 @@ class DatabasesCustomClientTest extends Scope 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], ], $this->getHeaders()), [ - 'documentId' => ID::custom($collection1['body']['$id']), + 'rowId' => ID::custom($collection1['body']['$id']), 'data' => [ 'Title' => 'Captain America', $collection2['body']['$id'] => [ @@ -739,7 +739,7 @@ class DatabasesCustomClientTest extends Scope 'x-appwrite-project' => $this->getProject()['$id'], 'x-appwrite-key' => $this->getProject()['apiKey'] ]), [ - 'collectionId' => ID::custom('collection3'), + 'tableId' => ID::custom('collection3'), 'name' => ID::custom('collection3'), 'documentSecurity' => false, 'permissions' => [ @@ -814,7 +814,7 @@ class DatabasesCustomClientTest extends Scope 'x-appwrite-project' => $this->getProject()['$id'], 'x-appwrite-key' => $this->getProject()['apiKey'] ]), [ - 'collectionId' => ID::custom('collection3'), + 'tableId' => ID::custom('collection3'), 'name' => ID::custom('collection3'), 'documentSecurity' => false, 'permissions' => [ @@ -830,7 +830,7 @@ class DatabasesCustomClientTest extends Scope 'x-appwrite-project' => $this->getProject()['$id'], 'x-appwrite-key' => $this->getProject()['apiKey'] ]), [ - 'collectionId' => ID::custom('collection2'), + 'tableId' => ID::custom('collection2'), 'name' => ID::custom('collection2'), 'documentSecurity' => false, 'permissions' => [ @@ -847,7 +847,7 @@ class DatabasesCustomClientTest extends Scope 'x-appwrite-project' => $this->getProject()['$id'], 'x-appwrite-key' => $this->getProject()['apiKey'] ]), [ - 'documentId' => ID::custom('collection3Doc1'), + 'rowId' => ID::custom('collection3Doc1'), 'data' => [ 'Rating' => '20' ] diff --git a/tests/e2e/Services/Databases/DatabasesCustomServerTest.php b/tests/e2e/Services/Databases/DatabasesCustomServerTest.php index 7e5da78ccd..508578f149 100644 --- a/tests/e2e/Services/Databases/DatabasesCustomServerTest.php +++ b/tests/e2e/Services/Databases/DatabasesCustomServerTest.php @@ -358,7 +358,7 @@ class DatabasesCustomServerTest extends Scope 'x-appwrite-key' => $this->getProject()['apiKey'] ]), [ 'name' => 'Test 1', - 'collectionId' => ID::custom('first'), + 'tableId' => ID::custom('first'), 'permissions' => [ Permission::read(Role::any()), Permission::create(Role::any()), @@ -374,7 +374,7 @@ class DatabasesCustomServerTest extends Scope 'x-appwrite-key' => $this->getProject()['apiKey'] ]), [ 'name' => 'Test 2', - 'collectionId' => ID::custom('second'), + 'tableId' => ID::custom('second'), 'permissions' => [ Permission::read(Role::any()), Permission::create(Role::any()), @@ -579,7 +579,7 @@ class DatabasesCustomServerTest extends Scope 'x-appwrite-key' => $this->getProject()['apiKey'] ]), [ 'name' => 'Test 1', - 'collectionId' => ID::custom('first'), + 'tableId' => ID::custom('first'), 'permissions' => [ Permission::read(Role::any()), Permission::create(Role::any()), @@ -592,7 +592,7 @@ class DatabasesCustomServerTest extends Scope $this->assertEquals(409, $response['headers']['status-code']); return [ 'databaseId' => $databaseId, - 'collectionId' => $test1['body']['$id'], + 'tableId' => $test1['body']['$id'], ]; } @@ -602,7 +602,7 @@ class DatabasesCustomServerTest extends Scope public function testGetCollection(array $data): void { $databaseId = $data['databaseId']; - $collectionId = $data['collectionId']; + $collectionId = $data['tableId']; $collection = $this->client->call(Client::METHOD_GET, '/databases/' . $databaseId . '/collections/' . $collectionId, array_merge([ 'content-type' => 'application/json', @@ -622,7 +622,7 @@ class DatabasesCustomServerTest extends Scope public function testUpdateCollection(array $data) { $databaseId = $data['databaseId']; - $collectionId = $data['collectionId']; + $collectionId = $data['tableId']; $collection = $this->client->call(Client::METHOD_PUT, '/databases/' . $databaseId . '/collections/' . $collectionId, array_merge([ 'content-type' => 'application/json', @@ -657,7 +657,7 @@ class DatabasesCustomServerTest extends Scope 'x-appwrite-project' => $this->getProject()['$id'], 'x-appwrite-key' => $this->getProject()['apiKey'] ]), [ - 'collectionId' => ID::unique(), + 'tableId' => ID::unique(), 'name' => 'Encrypted Actors Data', 'permissions' => [ Permission::read(Role::any()), @@ -719,7 +719,7 @@ class DatabasesCustomServerTest extends Scope 'x-appwrite-project' => $this->getProject()['$id'], 'x-appwrite-key' => $this->getProject()['apiKey'] ]), [ - 'documentId' => ID::unique(), + 'rowId' => ID::unique(), 'data' => [ 'firstName' => 'Jonah', 'lastName' => 'Jameson', @@ -767,7 +767,7 @@ class DatabasesCustomServerTest extends Scope 'x-appwrite-project' => $this->getProject()['$id'], 'x-appwrite-key' => $this->getProject()['apiKey'] ]), [ - 'collectionId' => ID::unique(), + 'tableId' => ID::unique(), 'name' => 'Actors', 'permissions' => [ Permission::read(Role::any()), @@ -820,7 +820,7 @@ class DatabasesCustomServerTest extends Scope 'x-appwrite-project' => $this->getProject()['$id'], 'x-appwrite-key' => $this->getProject()['apiKey'] ]), [ - 'documentId' => ID::unique(), + 'rowId' => ID::unique(), 'data' => [ 'firstName' => 'lorem', 'lastName' => 'ipsum', @@ -898,7 +898,7 @@ class DatabasesCustomServerTest extends Scope $this->assertEquals($collection['body']['columns'][1]['key'], $lastName['body']['key']); return [ - 'collectionId' => $actors['body']['$id'], + 'tableId' => $actors['body']['$id'], 'key' => $index['body']['key'], 'databaseId' => $databaseId ]; @@ -910,7 +910,7 @@ class DatabasesCustomServerTest extends Scope public function testDeleteIndex($data): array { $databaseId = $data['databaseId']; - $index = $this->client->call(Client::METHOD_DELETE, '/databases/' . $databaseId . '/collections/' . $data['collectionId'] . '/indexes/' . $data['key'], array_merge([ + $index = $this->client->call(Client::METHOD_DELETE, '/databases/' . $databaseId . '/collections/' . $data['tableId'] . '/indexes/' . $data['key'], array_merge([ 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], 'x-appwrite-key' => $this->getProject()['apiKey'] @@ -921,7 +921,7 @@ class DatabasesCustomServerTest extends Scope // Wait for database worker to finish deleting index sleep(2); - $collection = $this->client->call(Client::METHOD_GET, '/databases/' . $databaseId . '/collections/' . $data['collectionId'], array_merge([ + $collection = $this->client->call(Client::METHOD_GET, '/databases/' . $databaseId . '/collections/' . $data['tableId'], array_merge([ 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], 'x-appwrite-key' => $this->getProject()['apiKey'] @@ -938,7 +938,7 @@ class DatabasesCustomServerTest extends Scope public function testDeleteIndexOnDeleteAttribute($data) { $databaseId = $data['databaseId']; - $attribute1 = $this->client->call(Client::METHOD_POST, '/databases/' . $databaseId . '/collections/' . $data['collectionId'] . '/attributes/string', array_merge([ + $attribute1 = $this->client->call(Client::METHOD_POST, '/databases/' . $databaseId . '/collections/' . $data['tableId'] . '/attributes/string', array_merge([ 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], 'x-appwrite-key' => $this->getProject()['apiKey'] @@ -948,7 +948,7 @@ class DatabasesCustomServerTest extends Scope 'required' => true, ]); - $attribute2 = $this->client->call(Client::METHOD_POST, '/databases/' . $databaseId . '/collections/' . $data['collectionId'] . '/attributes/string', array_merge([ + $attribute2 = $this->client->call(Client::METHOD_POST, '/databases/' . $databaseId . '/collections/' . $data['tableId'] . '/attributes/string', array_merge([ 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], 'x-appwrite-key' => $this->getProject()['apiKey'] @@ -965,7 +965,7 @@ class DatabasesCustomServerTest extends Scope sleep(2); - $index1 = $this->client->call(Client::METHOD_POST, '/databases/' . $databaseId . '/collections/' . $data['collectionId'] . '/indexes', array_merge([ + $index1 = $this->client->call(Client::METHOD_POST, '/databases/' . $databaseId . '/collections/' . $data['tableId'] . '/indexes', array_merge([ 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], 'x-appwrite-key' => $this->getProject()['apiKey'] @@ -976,7 +976,7 @@ class DatabasesCustomServerTest extends Scope 'orders' => ['ASC', 'ASC'], ]); - $index2 = $this->client->call(Client::METHOD_POST, '/databases/' . $databaseId . '/collections/' . $data['collectionId'] . '/indexes', array_merge([ + $index2 = $this->client->call(Client::METHOD_POST, '/databases/' . $databaseId . '/collections/' . $data['tableId'] . '/indexes', array_merge([ 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], 'x-appwrite-key' => $this->getProject()['apiKey'] @@ -994,7 +994,7 @@ class DatabasesCustomServerTest extends Scope sleep(2); // Expected behavior: deleting attribute2 will cause index2 to be dropped, and index1 rebuilt with a single key - $deleted = $this->client->call(Client::METHOD_DELETE, '/databases/' . $databaseId . '/collections/' . $data['collectionId'] . '/attributes/' . $attribute2['body']['key'], array_merge([ + $deleted = $this->client->call(Client::METHOD_DELETE, '/databases/' . $databaseId . '/collections/' . $data['tableId'] . '/attributes/' . $attribute2['body']['key'], array_merge([ 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], 'x-appwrite-key' => $this->getProject()['apiKey'] @@ -1005,7 +1005,7 @@ class DatabasesCustomServerTest extends Scope // wait for database worker to complete sleep(2); - $collection = $this->client->call(Client::METHOD_GET, '/databases/' . $databaseId . '/collections/' . $data['collectionId'], array_merge([ + $collection = $this->client->call(Client::METHOD_GET, '/databases/' . $databaseId . '/collections/' . $data['tableId'], array_merge([ 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], 'x-appwrite-key' => $this->getProject()['apiKey'] @@ -1020,7 +1020,7 @@ class DatabasesCustomServerTest extends Scope $this->assertEquals($attribute1['body']['key'], $collection['body']['indexes'][0]['columns'][0]); // Delete attribute - $deleted = $this->client->call(Client::METHOD_DELETE, '/databases/' . $databaseId . '/collections/' . $data['collectionId'] . '/attributes/' . $attribute1['body']['key'], array_merge([ + $deleted = $this->client->call(Client::METHOD_DELETE, '/databases/' . $databaseId . '/collections/' . $data['tableId'] . '/attributes/' . $attribute1['body']['key'], array_merge([ 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], 'x-appwrite-key' => $this->getProject()['apiKey'] @@ -1050,7 +1050,7 @@ class DatabasesCustomServerTest extends Scope 'x-appwrite-project' => $this->getProject()['$id'], 'x-appwrite-key' => $this->getProject()['apiKey'] ]), [ - 'collectionId' => ID::unique(), + 'tableId' => ID::unique(), 'name' => 'TestCleanupDuplicateIndexOnDeleteAttribute', 'permissions' => [ Permission::read(Role::any()), @@ -1163,14 +1163,14 @@ class DatabasesCustomServerTest extends Scope public function testDeleteCollection($data) { $databaseId = $data['databaseId']; - $collectionId = $data['collectionId']; + $collectionId = $data['tableId']; // Add Documents to the collection $document1 = $this->client->call(Client::METHOD_POST, '/databases/' . $databaseId . '/collections/' . $collectionId . '/documents', array_merge([ 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], ], $this->getHeaders()), [ - 'documentId' => ID::unique(), + 'rowId' => ID::unique(), 'data' => [ 'firstName' => 'Tom', 'lastName' => 'Holland', @@ -1186,7 +1186,7 @@ class DatabasesCustomServerTest extends Scope 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], ], $this->getHeaders()), [ - 'documentId' => ID::unique(), + 'rowId' => ID::unique(), 'data' => [ 'firstName' => 'Samuel', 'lastName' => 'Jackson', @@ -1249,7 +1249,7 @@ class DatabasesCustomServerTest extends Scope 'x-appwrite-project' => $this->getProject()['$id'], 'x-appwrite-key' => $this->getProject()['apiKey'] ]), [ - 'collectionId' => ID::unique(), + 'tableId' => ID::unique(), 'name' => 'Collection1', 'documentSecurity' => false, 'permissions' => [], @@ -1260,7 +1260,7 @@ class DatabasesCustomServerTest extends Scope 'x-appwrite-project' => $this->getProject()['$id'], 'x-appwrite-key' => $this->getProject()['apiKey'] ]), [ - 'collectionId' => ID::unique(), + 'tableId' => ID::unique(), 'name' => 'Collection2', 'documentSecurity' => false, 'permissions' => [], @@ -1274,7 +1274,7 @@ class DatabasesCustomServerTest extends Scope 'x-appwrite-project' => $this->getProject()['$id'], 'x-appwrite-key' => $this->getProject()['apiKey'], ]), [ - 'relatedCollectionId' => $collection2, + 'relatedTableId' => $collection2, 'type' => Database::RELATION_MANY_TO_ONE, 'twoWay' => false, 'key' => 'collection2' @@ -1318,7 +1318,7 @@ class DatabasesCustomServerTest extends Scope 'x-appwrite-project' => $this->getProject()['$id'], 'x-appwrite-key' => $this->getProject()['apiKey'] ]), [ - 'collectionId' => ID::custom('attributeRowWidthLimit'), + 'tableId' => ID::custom('attributeRowWidthLimit'), 'name' => 'attributeRowWidthLimit', 'permissions' => [ Permission::read(Role::any()), @@ -1384,7 +1384,7 @@ class DatabasesCustomServerTest extends Scope 'x-appwrite-project' => $this->getProject()['$id'], 'x-appwrite-key' => $this->getProject()['apiKey'] ]), [ - 'collectionId' => ID::custom('testLimitException'), + 'tableId' => ID::custom('testLimitException'), 'name' => 'testLimitException', 'permissions' => [ Permission::read(Role::any()), @@ -1508,7 +1508,7 @@ class DatabasesCustomServerTest extends Scope 'x-appwrite-project' => $this->getProject()['$id'], 'x-appwrite-key' => $this->getProject()['apiKey'] ]), [ - 'collectionId' => ID::custom('updateAttributes'), + 'tableId' => ID::custom('updateAttributes'), 'name' => 'updateAttributes' ]); @@ -1642,7 +1642,7 @@ class DatabasesCustomServerTest extends Scope return [ 'databaseId' => $databaseId, - 'collectionId' => $collectionId + 'tableId' => $collectionId ]; } @@ -1653,7 +1653,7 @@ class DatabasesCustomServerTest extends Scope { $key = 'string'; $databaseId = $data['databaseId']; - $collectionId = $data['collectionId']; + $collectionId = $data['tableId']; $update = $this->client->call(Client::METHOD_PATCH, '/databases/' . $databaseId . '/collections/' . $collectionId . '/attributes/string/' . $key, array_merge([ 'content-type' => 'application/json', @@ -1795,7 +1795,7 @@ class DatabasesCustomServerTest extends Scope { $key = 'email'; $databaseId = $data['databaseId']; - $collectionId = $data['collectionId']; + $collectionId = $data['tableId']; $update = $this->client->call(Client::METHOD_PATCH, '/databases/' . $databaseId . '/collections/' . $collectionId . '/attributes/email/' . $key, array_merge([ 'content-type' => 'application/json', @@ -1938,7 +1938,7 @@ class DatabasesCustomServerTest extends Scope { $key = 'ip'; $databaseId = $data['databaseId']; - $collectionId = $data['collectionId']; + $collectionId = $data['tableId']; $update = $this->client->call(Client::METHOD_PATCH, '/databases/' . $databaseId . '/collections/' . $collectionId . '/attributes/ip/' . $key, array_merge([ 'content-type' => 'application/json', @@ -2080,7 +2080,7 @@ class DatabasesCustomServerTest extends Scope { $key = 'url'; $databaseId = $data['databaseId']; - $collectionId = $data['collectionId']; + $collectionId = $data['tableId']; $update = $this->client->call(Client::METHOD_PATCH, '/databases/' . $databaseId . '/collections/' . $collectionId . '/attributes/url/' . $key, array_merge([ 'content-type' => 'application/json', @@ -2222,7 +2222,7 @@ class DatabasesCustomServerTest extends Scope { $key = 'integer'; $databaseId = $data['databaseId']; - $collectionId = $data['collectionId']; + $collectionId = $data['tableId']; $update = $this->client->call(Client::METHOD_PATCH, '/databases/' . $databaseId . '/collections/' . $collectionId . '/attributes/integer/' . $key, array_merge([ 'content-type' => 'application/json', @@ -2483,7 +2483,7 @@ class DatabasesCustomServerTest extends Scope { $key = 'float'; $databaseId = $data['databaseId']; - $collectionId = $data['collectionId']; + $collectionId = $data['tableId']; $update = $this->client->call(Client::METHOD_PATCH, '/databases/' . $databaseId . '/collections/' . $collectionId . '/attributes/float/' . $key, array_merge([ 'content-type' => 'application/json', @@ -2744,7 +2744,7 @@ class DatabasesCustomServerTest extends Scope { $key = 'boolean'; $databaseId = $data['databaseId']; - $collectionId = $data['collectionId']; + $collectionId = $data['tableId']; $update = $this->client->call(Client::METHOD_PATCH, '/databases/' . $databaseId . '/collections/' . $collectionId . '/attributes/boolean/' . $key, array_merge([ 'content-type' => 'application/json', @@ -2886,7 +2886,7 @@ class DatabasesCustomServerTest extends Scope { $key = 'datetime'; $databaseId = $data['databaseId']; - $collectionId = $data['collectionId']; + $collectionId = $data['tableId']; $update = $this->client->call(Client::METHOD_PATCH, '/databases/' . $databaseId . '/collections/' . $collectionId . '/attributes/datetime/' . $key, array_merge([ 'content-type' => 'application/json', @@ -3028,7 +3028,7 @@ class DatabasesCustomServerTest extends Scope { $key = 'enum'; $databaseId = $data['databaseId']; - $collectionId = $data['collectionId']; + $collectionId = $data['tableId']; $update = $this->client->call(Client::METHOD_PATCH, '/databases/' . $databaseId . '/collections/' . $collectionId . '/attributes/enum/' . $key, array_merge([ 'content-type' => 'application/json', @@ -3244,7 +3244,7 @@ class DatabasesCustomServerTest extends Scope { $key = 'string'; $databaseId = $data['databaseId']; - $collectionId = $data['collectionId']; + $collectionId = $data['tableId']; $document = $this->client->call( Client::METHOD_POST, @@ -3255,7 +3255,7 @@ class DatabasesCustomServerTest extends Scope 'x-appwrite-key' => $this->getProject()['apiKey'] ]), [ - 'documentId' => 'unique()', + 'rowId' => 'unique()', 'data' => [ 'string' => 'string' ], @@ -3287,7 +3287,7 @@ class DatabasesCustomServerTest extends Scope 'x-appwrite-key' => $this->getProject()['apiKey'] ]), [ - 'documentId' => 'unique()', + 'rowId' => 'unique()', 'data' => [ 'string' => str_repeat('a', 2048) ], @@ -3373,7 +3373,7 @@ class DatabasesCustomServerTest extends Scope 'x-appwrite-key' => $this->getProject()['apiKey'] ]), [ - 'documentId' => 'unique()', + 'rowId' => 'unique()', 'data' => [ 'string' => str_repeat('a', 10) ], @@ -3408,7 +3408,7 @@ class DatabasesCustomServerTest extends Scope 'x-appwrite-key' => $this->getProject()['apiKey'] ]), [ - 'documentId' => 'unique()', + 'rowId' => 'unique()', 'data' => [ 'string' => str_repeat('a', 11) ], @@ -3426,7 +3426,7 @@ class DatabasesCustomServerTest extends Scope public function testAttributeUpdateNotFound(array $data) { $databaseId = $data['databaseId']; - $collectionId = $data['collectionId']; + $collectionId = $data['tableId']; $attributes = [ 'string' => [ @@ -3514,7 +3514,7 @@ class DatabasesCustomServerTest extends Scope { $key = 'string'; $databaseId = $data['databaseId']; - $collectionId = $data['collectionId']; + $collectionId = $data['tableId']; // Create document to test against $document = $this->client->call( @@ -3526,7 +3526,7 @@ class DatabasesCustomServerTest extends Scope 'x-appwrite-key' => $this->getProject()['apiKey'] ]), [ - 'documentId' => 'unique()', + 'rowId' => 'unique()', 'data' => [ 'string' => 'string' ], @@ -3578,7 +3578,7 @@ class DatabasesCustomServerTest extends Scope 'x-appwrite-key' => $this->getProject()['apiKey'] ]), [ - 'documentId' => 'unique()', + 'rowId' => 'unique()', 'data' => [ 'new_string' => 'string' ], @@ -3600,7 +3600,7 @@ class DatabasesCustomServerTest extends Scope 'x-appwrite-key' => $this->getProject()['apiKey'] ]), [ - 'documentId' => 'unique()', + 'rowId' => 'unique()', 'data' => [ 'string' => 'string' ], @@ -3630,7 +3630,7 @@ class DatabasesCustomServerTest extends Scope 'x-appwrite-project' => $this->getProject()['$id'], 'x-appwrite-key' => $this->getProject()['apiKey'] ]), [ - 'collectionId' => 'collection1', + 'tableId' => 'collection1', 'name' => 'level1', 'documentSecurity' => false, 'permissions' => [ @@ -3646,7 +3646,7 @@ class DatabasesCustomServerTest extends Scope 'x-appwrite-project' => $this->getProject()['$id'], 'x-appwrite-key' => $this->getProject()['apiKey'] ]), [ - 'collectionId' => 'collection2', + 'tableId' => 'collection2', 'name' => 'level2', 'documentSecurity' => false, 'permissions' => [ @@ -3684,7 +3684,7 @@ class DatabasesCustomServerTest extends Scope 'x-appwrite-project' => $this->getProject()['$id'], 'x-appwrite-key' => $this->getProject()['apiKey'] ]), [ - 'relatedCollectionId' => $collection2Id, + 'relatedTableId' => $collection2Id, 'type' => 'oneToMany', 'twoWay' => true, 'onDelete' => 'cascade', @@ -3712,7 +3712,7 @@ class DatabasesCustomServerTest extends Scope 'x-appwrite-project' => $this->getProject()['$id'], 'x-appwrite-key' => $this->getProject()['apiKey'] ]), [ - 'documentId' => 'unique()', + 'rowId' => 'unique()', 'data' => [ 'level2' => [[ '$id' => 'unique()', @@ -3794,7 +3794,7 @@ class DatabasesCustomServerTest extends Scope 'x-appwrite-project' => $this->getProject()['$id'], 'x-appwrite-key' => $this->getProject()['apiKey'] ]), [ - 'relatedCollectionId' => $collection2Id, + 'relatedTableId' => $collection2Id, 'type' => 'oneToOne', 'twoWay' => true, 'onDelete' => 'cascade', @@ -3822,7 +3822,7 @@ class DatabasesCustomServerTest extends Scope 'x-appwrite-project' => $this->getProject()['$id'], 'x-appwrite-key' => $this->getProject()['apiKey'] ]), [ - 'documentId' => 'unique()', + 'rowId' => 'unique()', 'data' => [ 'level2' => [ '$id' => 'unique()', @@ -3904,7 +3904,7 @@ class DatabasesCustomServerTest extends Scope 'x-appwrite-project' => $this->getProject()['$id'], 'x-appwrite-key' => $this->getProject()['apiKey'] ]), [ - 'relatedCollectionId' => $collection2Id, + 'relatedTableId' => $collection2Id, 'type' => 'manyToOne', 'twoWay' => true, 'onDelete' => 'cascade', @@ -3932,7 +3932,7 @@ class DatabasesCustomServerTest extends Scope 'x-appwrite-project' => $this->getProject()['$id'], 'x-appwrite-key' => $this->getProject()['apiKey'] ]), [ - 'documentId' => 'unique()', + 'rowId' => 'unique()', 'data' => [ 'level2' => [ '$id' => 'unique()', @@ -4014,7 +4014,7 @@ class DatabasesCustomServerTest extends Scope 'x-appwrite-project' => $this->getProject()['$id'], 'x-appwrite-key' => $this->getProject()['apiKey'] ]), [ - 'relatedCollectionId' => $collection2Id, + 'relatedTableId' => $collection2Id, 'type' => 'manyToOne', 'twoWay' => true, 'onDelete' => 'cascade', @@ -4042,7 +4042,7 @@ class DatabasesCustomServerTest extends Scope 'x-appwrite-project' => $this->getProject()['$id'], 'x-appwrite-key' => $this->getProject()['apiKey'] ]), [ - 'documentId' => 'unique()', + 'rowId' => 'unique()', 'data' => [ 'level2' => [ '$id' => 'unique()', diff --git a/tests/e2e/Services/Databases/DatabasesPermissionsGuestTest.php b/tests/e2e/Services/Databases/DatabasesPermissionsGuestTest.php index 9e20e13c2a..64413c2fab 100644 --- a/tests/e2e/Services/Databases/DatabasesPermissionsGuestTest.php +++ b/tests/e2e/Services/Databases/DatabasesPermissionsGuestTest.php @@ -32,7 +32,7 @@ class DatabasesPermissionsGuestTest extends Scope $databaseId = $database['body']['$id']; $publicMovies = $this->client->call(Client::METHOD_POST, '/databases/' . $databaseId . '/collections', $this->getServerHeader(), [ - 'collectionId' => ID::unique(), + 'tableId' => ID::unique(), 'name' => 'Movies', 'permissions' => [ Permission::read(Role::any()), @@ -42,7 +42,7 @@ class DatabasesPermissionsGuestTest extends Scope ], ]); $privateMovies = $this->client->call(Client::METHOD_POST, '/databases/' . $databaseId . '/collections', $this->getServerHeader(), [ - 'collectionId' => ID::unique(), + 'tableId' => ID::unique(), 'name' => 'Movies', 'permissions' => [], 'documentSecurity' => true, @@ -94,14 +94,14 @@ class DatabasesPermissionsGuestTest extends Scope $databaseId = $data['databaseId']; $publicResponse = $this->client->call(Client::METHOD_POST, '/databases/' . $databaseId . '/collections/' . $publicCollectionId . '/documents', $this->getServerHeader(), [ - 'documentId' => ID::unique(), + 'rowId' => ID::unique(), 'data' => [ 'title' => 'Lorem', ], 'permissions' => $permissions, ]); $privateResponse = $this->client->call(Client::METHOD_POST, '/databases/' . $databaseId . '/collections/' . $privateCollectionId . '/documents', $this->getServerHeader(), [ - 'documentId' => ID::unique(), + 'rowId' => ID::unique(), 'data' => [ 'title' => 'Lorem', ], @@ -152,7 +152,7 @@ class DatabasesPermissionsGuestTest extends Scope 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], ], [ - 'documentId' => ID::unique(), + 'rowId' => ID::unique(), 'data' => [ 'title' => 'Lorem', ] @@ -165,7 +165,7 @@ class DatabasesPermissionsGuestTest extends Scope 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], ], [ - 'documentId' => ID::unique(), + 'rowId' => ID::unique(), 'data' => [ 'title' => 'Lorem', ], @@ -175,7 +175,7 @@ class DatabasesPermissionsGuestTest extends Scope // Create a document in private collection with API key so we can test that update and delete are also not allowed $privateResponse = $this->client->call(Client::METHOD_POST, '/databases/' . $databaseId . '/collections/' . $privateCollectionId . '/documents', $this->getServerHeader(), [ - 'documentId' => ID::unique(), + 'rowId' => ID::unique(), 'data' => [ 'title' => 'Lorem', ], @@ -241,7 +241,7 @@ class DatabasesPermissionsGuestTest extends Scope $databaseId = $database['body']['$id']; $movies = $this->client->call(Client::METHOD_POST, '/databases/' . $databaseId . '/collections', $this->getServerHeader(), [ - 'collectionId' => ID::unique(), + 'tableId' => ID::unique(), 'name' => 'Movies', 'permissions' => [ Permission::create(Role::any()), @@ -263,7 +263,7 @@ class DatabasesPermissionsGuestTest extends Scope 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], ], [ - 'documentId' => ID::unique(), + 'rowId' => ID::unique(), 'data' => [ 'title' => 'Thor: Ragnarok', ], diff --git a/tests/e2e/Services/Databases/DatabasesPermissionsMemberTest.php b/tests/e2e/Services/Databases/DatabasesPermissionsMemberTest.php index 239fa58c99..2b959344fe 100644 --- a/tests/e2e/Services/Databases/DatabasesPermissionsMemberTest.php +++ b/tests/e2e/Services/Databases/DatabasesPermissionsMemberTest.php @@ -125,7 +125,7 @@ class DatabasesPermissionsMemberTest extends Scope $databaseId = $db['body']['$id']; $public = $this->client->call(Client::METHOD_POST, '/databases/' . $databaseId . '/collections', $this->getServerHeader(), [ - 'collectionId' => ID::unique(), + 'tableId' => ID::unique(), 'name' => 'Movies', 'permissions' => [ Permission::read(Role::any()), @@ -146,7 +146,7 @@ class DatabasesPermissionsMemberTest extends Scope $this->assertEquals(202, $response['headers']['status-code']); $private = $this->client->call(Client::METHOD_POST, '/databases/' . $databaseId . '/collections', $this->getServerHeader(), [ - 'collectionId' => ID::unique(), + 'tableId' => ID::unique(), 'name' => 'Private Movies', 'permissions' => [ Permission::read(Role::users()), @@ -167,7 +167,7 @@ class DatabasesPermissionsMemberTest extends Scope $this->assertEquals(202, $response['headers']['status-code']); $doconly = $this->client->call(Client::METHOD_POST, '/databases/' . $databaseId . '/collections', $this->getServerHeader(), [ - 'collectionId' => ID::unique(), + 'tableId' => ID::unique(), 'name' => 'Document Only Movies', 'permissions' => [], 'documentSecurity' => true, @@ -203,7 +203,7 @@ class DatabasesPermissionsMemberTest extends Scope $databaseId = $data['databaseId']; $response = $this->client->call(Client::METHOD_POST, '/databases/' . $databaseId . '/collections/' . $collections['public'] . '/documents', $this->getServerHeader(), [ - 'documentId' => ID::unique(), + 'rowId' => ID::unique(), 'data' => [ 'title' => 'Lorem', ], @@ -212,7 +212,7 @@ class DatabasesPermissionsMemberTest extends Scope $this->assertEquals(201, $response['headers']['status-code']); $response = $this->client->call(Client::METHOD_POST, '/databases/' . $databaseId . '/collections/' . $collections['private'] . '/documents', $this->getServerHeader(), [ - 'documentId' => ID::unique(), + 'rowId' => ID::unique(), 'data' => [ 'title' => 'Lorem', ], @@ -221,7 +221,7 @@ class DatabasesPermissionsMemberTest extends Scope $this->assertEquals(201, $response['headers']['status-code']); $response = $this->client->call(Client::METHOD_POST, '/databases/' . $databaseId . '/collections/' . $collections['doconly'] . '/documents', $this->getServerHeader(), [ - 'documentId' => ID::unique(), + 'rowId' => ID::unique(), 'data' => [ 'title' => 'Lorem', ], diff --git a/tests/e2e/Services/Databases/DatabasesPermissionsTeamTest.php b/tests/e2e/Services/Databases/DatabasesPermissionsTeamTest.php index 9b0a04ac27..5a160a25b8 100644 --- a/tests/e2e/Services/Databases/DatabasesPermissionsTeamTest.php +++ b/tests/e2e/Services/Databases/DatabasesPermissionsTeamTest.php @@ -45,7 +45,7 @@ class DatabasesPermissionsTeamTest extends Scope $this->assertEquals(201, $db['headers']['status-code']); $collection1 = $this->client->call(Client::METHOD_POST, '/databases/' . $this->databaseId . '/collections', $this->getServerHeader(), [ - 'collectionId' => ID::custom('collection1'), + 'tableId' => ID::custom('collection1'), 'name' => 'Collection 1', 'permissions' => [ Permission::read(Role::team($teams['team1']['$id'])), @@ -64,7 +64,7 @@ class DatabasesPermissionsTeamTest extends Scope ]); $collection2 = $this->client->call(Client::METHOD_POST, '/databases/' . $this->databaseId . '/collections', $this->getServerHeader(), [ - 'collectionId' => ID::custom('collection2'), + 'tableId' => ID::custom('collection2'), 'name' => 'Collection 2', 'permissions' => [ Permission::read(Role::team($teams['team2']['$id'])), @@ -141,7 +141,7 @@ class DatabasesPermissionsTeamTest extends Scope $this->createCollections($this->teams); $response = $this->client->call(Client::METHOD_POST, '/databases/' . $this->databaseId . '/collections/' . $this->collections['collection1'] . '/documents', $this->getServerHeader(), [ - 'documentId' => ID::unique(), + 'rowId' => ID::unique(), 'data' => [ 'title' => 'Lorem', ], @@ -149,7 +149,7 @@ class DatabasesPermissionsTeamTest extends Scope $this->assertEquals(201, $response['headers']['status-code']); $response = $this->client->call(Client::METHOD_POST, '/databases/' . $this->databaseId . '/collections/' . $this->collections['collection2'] . '/documents', $this->getServerHeader(), [ - 'documentId' => ID::unique(), + 'rowId' => ID::unique(), 'data' => [ 'title' => 'Ipsum', ], @@ -192,7 +192,7 @@ class DatabasesPermissionsTeamTest extends Scope 'x-appwrite-project' => $this->getProject()['$id'], 'cookie' => 'a_session_' . $this->getProject()['$id'] . '=' . $users[$user]['session'], ], [ - 'documentId' => ID::unique(), + 'rowId' => ID::unique(), 'data' => [ 'title' => 'Ipsum', ], diff --git a/tests/e2e/Services/GraphQL/AbuseTest.php b/tests/e2e/Services/GraphQL/AbuseTest.php index 7137123757..10b8421b04 100644 --- a/tests/e2e/Services/GraphQL/AbuseTest.php +++ b/tests/e2e/Services/GraphQL/AbuseTest.php @@ -30,7 +30,7 @@ class AbuseTest extends Scope { $data = $this->createCollection(); $databaseId = $data['databaseId']; - $collectionId = $data['collectionId']; + $collectionId = $data['tableId']; $projectId = $this->getProject()['$id']; $query = $this->getQuery(self::$CREATE_ROW); $max = 120; @@ -40,8 +40,8 @@ class AbuseTest extends Scope 'query' => $query, 'variables' => [ 'databaseId' => $databaseId, - 'collectionId' => $collectionId, - 'documentId' => ID::unique(), + 'tableId' => $collectionId, + 'rowId' => ID::unique(), 'data' => [ 'name' => 'John Doe', ], @@ -73,7 +73,7 @@ class AbuseTest extends Scope 'password' => 'password', 'databaseId' => 'database', 'databaseName' => 'database', - 'collectionId' => 'collection', + 'tableId' => 'collection', 'collectionName' => 'collection', 'collectionPermissions' => [ Permission::read(Role::users()), @@ -138,7 +138,7 @@ class AbuseTest extends Scope 'query' => $query, 'variables' => [ 'databaseId' => $databaseId, - 'collectionId' => 'actors', + 'tableId' => 'actors', 'name' => 'Actors', 'documentSecurity' => false, 'permissions' => [ @@ -161,7 +161,7 @@ class AbuseTest extends Scope 'query' => $query, 'variables' => [ 'databaseId' => $databaseId, - 'collectionId' => $collectionId, + 'tableId' => $collectionId, 'key' => 'name', 'size' => 256, 'required' => true, @@ -178,7 +178,7 @@ class AbuseTest extends Scope return [ 'databaseId' => $databaseId, - 'collectionId' => $collectionId, + 'tableId' => $collectionId, ]; } } diff --git a/tests/e2e/Services/GraphQL/Base.php b/tests/e2e/Services/GraphQL/Base.php index 7c91cf67f7..22112d2e12 100644 --- a/tests/e2e/Services/GraphQL/Base.php +++ b/tests/e2e/Services/GraphQL/Base.php @@ -672,7 +672,7 @@ trait Base return 'query getRow($databaseId: String!, $tableId: String!, $rowId: String!) { databasesGetRow(databaseId: $databaseId, tableId: $tableId, rowId: $rowId) { _id - _collectionId + _tableId _permissions data } @@ -683,7 +683,7 @@ trait Base total rows { _id - _collectionId + _tableId _permissions data } @@ -693,7 +693,7 @@ trait Base return 'mutation createRow($databaseId: String!, $tableId: String!, $rowId: String!, $data: Json!, $permissions: [String!]){ databasesCreateRow(databaseId: $databaseId, tableId: $tableId, rowId: $rowId, data: $data, permissions: $permissions) { _id - _collectionId + _tableId _permissions } }'; @@ -760,7 +760,7 @@ trait Base return 'mutation updateRow($databaseId: String!, $tableId: String!, $rowId: String!, $data: Json!, $permissions: [String!]){ databasesUpdateRow(databaseId: $databaseId, tableId: $tableId, rowId: $rowId, data: $data, permissions: $permissions) { _id - _collectionId + _tableId data } }'; diff --git a/tests/e2e/Services/Migrations/MigrationsBase.php b/tests/e2e/Services/Migrations/MigrationsBase.php index 208bd58731..a40a2156ea 100644 --- a/tests/e2e/Services/Migrations/MigrationsBase.php +++ b/tests/e2e/Services/Migrations/MigrationsBase.php @@ -445,7 +445,7 @@ trait MigrationsBase 'x-appwrite-project' => $this->getProject()['$id'], 'x-appwrite-key' => $this->getProject()['apiKey'], ], [ - 'collectionId' => ID::unique(), + 'tableId' => ID::unique(), 'name' => 'Test Collection', ]); @@ -536,7 +536,7 @@ trait MigrationsBase return [ 'databaseId' => $databaseId, - 'collectionId' => $collectionId, + 'tableId' => $collectionId, ]; } @@ -546,14 +546,14 @@ trait MigrationsBase public function testAppwriteMigrationDatabasesDocument(array $data): void { $databaseId = $data['databaseId']; - $collectionId = $data['collectionId']; + $collectionId = $data['tableId']; $document = $this->client->call(Client::METHOD_POST, '/databases/' . $databaseId . '/collections/' . $collectionId . '/documents', [ 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], 'x-appwrite-key' => $this->getProject()['apiKey'], ], [ - 'documentId' => ID::unique(), + 'rowId' => ID::unique(), 'data' => [ 'name' => 'Test Document', ] @@ -927,7 +927,7 @@ trait MigrationsBase 'x-appwrite-key' => $this->getProject()['apiKey'] ]), [ 'name' => 'Test collection', - 'collectionId' => ID::unique(), + 'tableId' => ID::unique(), ]); $this->assertEquals(201, $response['headers']['status-code']); @@ -1131,7 +1131,7 @@ trait MigrationsBase return [ 'databaseId' => $databaseId, - 'collectionId' => $collectionId, + 'tableId' => $collectionId, 'migrationId' => $migration['body']['$id'], ]; } @@ -1142,7 +1142,7 @@ trait MigrationsBase public function testImportSuccessful(array $response): void { $databaseId = $response['databaseId']; - $collectionId = $response['collectionId']; + $collectionId = $response['tableId']; $migrationId = $response['migrationId']; $documentsCountInCSV = 100; diff --git a/tests/e2e/Services/Realtime/RealtimeConsoleClientTest.php b/tests/e2e/Services/Realtime/RealtimeConsoleClientTest.php index a206692ea2..bb21ef8619 100644 --- a/tests/e2e/Services/Realtime/RealtimeConsoleClientTest.php +++ b/tests/e2e/Services/Realtime/RealtimeConsoleClientTest.php @@ -162,7 +162,7 @@ class RealtimeConsoleClientTest extends Scope 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], ], $this->getHeaders()), [ - 'collectionId' => ID::unique(), + 'tableId' => ID::unique(), 'name' => 'Actors', 'permissions' => [ Permission::read(Role::any()), @@ -272,7 +272,7 @@ class RealtimeConsoleClientTest extends Scope ], $this->getHeaders()), [ 'key' => 'key_name', 'type' => 'key', - 'attributes' => [ + 'columns' => [ 'name', ], ]); diff --git a/tests/e2e/Services/Realtime/RealtimeCustomClientTest.php b/tests/e2e/Services/Realtime/RealtimeCustomClientTest.php index d279bb45c7..671bc491f4 100644 --- a/tests/e2e/Services/Realtime/RealtimeCustomClientTest.php +++ b/tests/e2e/Services/Realtime/RealtimeCustomClientTest.php @@ -714,7 +714,7 @@ class RealtimeCustomClientTest extends Scope 'x-appwrite-project' => $this->getProject()['$id'], 'x-appwrite-key' => $this->getProject()['apiKey'] ]), [ - 'collectionId' => ID::unique(), + 'tableId' => ID::unique(), 'name' => 'Actors', 'permissions' => [ Permission::create(Role::user($this->getUser()['$id'])), @@ -749,7 +749,7 @@ class RealtimeCustomClientTest extends Scope 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], ], $this->getHeaders()), [ - 'documentId' => ID::unique(), + 'rowId' => ID::unique(), 'data' => [ 'name' => 'Chris Evans' ], @@ -795,7 +795,7 @@ class RealtimeCustomClientTest extends Scope 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], ], $this->getHeaders()), [ - 'documentId' => ID::unique(), + 'rowId' => ID::unique(), 'data' => [ 'name' => 'Chris Evans 2' ], @@ -840,7 +840,7 @@ class RealtimeCustomClientTest extends Scope 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], ], $this->getHeaders()), [ - 'documentId' => ID::unique(), + 'rowId' => ID::unique(), 'data' => [ 'name' => 'Bradley Cooper' ], @@ -934,7 +934,7 @@ class RealtimeCustomClientTest extends Scope 'x-appwrite-project' => $this->getProject()['$id'], 'x-appwrite-key' => $this->getProject()['apiKey'] ]), [ - 'collectionId' => ID::unique(), + 'tableId' => ID::unique(), 'name' => 'Actors', 'permissions' => [ Permission::read(Role::any()), @@ -971,7 +971,7 @@ class RealtimeCustomClientTest extends Scope 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], ], $this->getHeaders()), [ - 'documentId' => ID::unique(), + 'rowId' => ID::unique(), 'data' => [ 'name' => 'Chris Evans' ], @@ -1053,7 +1053,7 @@ class RealtimeCustomClientTest extends Scope 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], ], $this->getHeaders()), [ - 'documentId' => ID::unique(), + 'rowId' => ID::unique(), 'data' => [ 'name' => 'Bradley Cooper' ], diff --git a/tests/e2e/Services/Webhooks/WebhooksBase.php b/tests/e2e/Services/Webhooks/WebhooksBase.php index 5cd95c220d..feb43d17ab 100644 --- a/tests/e2e/Services/Webhooks/WebhooksBase.php +++ b/tests/e2e/Services/Webhooks/WebhooksBase.php @@ -61,7 +61,7 @@ trait WebhooksBase 'x-appwrite-project' => $this->getProject()['$id'], 'x-appwrite-key' => $this->getProject()['apiKey'] ]), [ - 'collectionId' => ID::unique(), + 'tableId' => ID::unique(), 'name' => 'Actors', 'permissions' => [ Permission::read(Role::any()), @@ -211,7 +211,7 @@ trait WebhooksBase 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], ], $this->getHeaders()), [ - 'documentId' => ID::unique(), + 'rowId' => ID::unique(), 'data' => [ 'firstName' => 'Chris', 'lastName' => 'Evans', @@ -254,7 +254,7 @@ trait WebhooksBase $this->assertIsArray($webhook['data']['$permissions']); $this->assertCount(3, $webhook['data']['$permissions']); - $data['documentId'] = $document['body']['$id']; + $data['rowId'] = $document['body']['$id']; return $data; } @@ -270,7 +270,7 @@ trait WebhooksBase /** * Test for SUCCESS */ - $document = $this->client->call(Client::METHOD_PATCH, '/databases/' . $databaseId . '/collections/' . $actorsId . '/documents/' . $data['documentId'], array_merge([ + $document = $this->client->call(Client::METHOD_PATCH, '/databases/' . $databaseId . '/collections/' . $actorsId . '/documents/' . $data['rowId'], array_merge([ 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], ], $this->getHeaders()), [ @@ -335,7 +335,7 @@ trait WebhooksBase 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], ], $this->getHeaders()), [ - 'documentId' => ID::unique(), + 'rowId' => ID::unique(), 'data' => [ 'firstName' => 'Bradly', 'lastName' => 'Cooper', @@ -1119,7 +1119,7 @@ trait WebhooksBase 'x-appwrite-project' => $this->getProject()['$id'], 'x-appwrite-key' => $this->getProject()['apiKey'] ]), [ - 'collectionId' => ID::unique(), + 'tableId' => ID::unique(), 'name' => 'newCollection' . $i, 'permissions' => [ Permission::read(Role::any()), diff --git a/tests/e2e/Services/Webhooks/WebhooksCustomServerTest.php b/tests/e2e/Services/Webhooks/WebhooksCustomServerTest.php index 14188a807b..83a29b741f 100644 --- a/tests/e2e/Services/Webhooks/WebhooksCustomServerTest.php +++ b/tests/e2e/Services/Webhooks/WebhooksCustomServerTest.php @@ -79,7 +79,7 @@ class WebhooksCustomServerTest extends Scope ]), [ 'key' => 'fullname', 'type' => 'key', - 'attributes' => ['lastName', 'firstName'], + 'columns' => ['lastName', 'firstName'], 'orders' => ['ASC', 'ASC'], ]); @@ -159,7 +159,7 @@ class WebhooksCustomServerTest extends Scope 'x-appwrite-project' => $this->getProject()['$id'], 'x-appwrite-key' => $this->getProject()['apiKey'] ]), [ - 'collectionId' => ID::unique(), + 'tableId' => ID::unique(), 'name' => 'Demo', 'permissions' => [ Permission::read(Role::any()), From 253c428ca226de5c777f87d56f6877ec3d42949d Mon Sep 17 00:00:00 2001 From: Darshan Date: Tue, 6 May 2025 11:30:15 +0530 Subject: [PATCH 06/10] remove: filter. --- app/controllers/general.php | 4 ---- 1 file changed, 4 deletions(-) diff --git a/app/controllers/general.php b/app/controllers/general.php index f07fb2f178..6f46f529ce 100644 --- a/app/controllers/general.php +++ b/app/controllers/general.php @@ -18,7 +18,6 @@ use Appwrite\SDK\Response as SDKResponse; use Appwrite\Transformation\Adapter\Preview; use Appwrite\Transformation\Transformation; use Appwrite\Utopia\Request; -use Appwrite\Utopia\Request\Filters\DatabaseAliases; use Appwrite\Utopia\Request\Filters\V16 as RequestV16; use Appwrite\Utopia\Request\Filters\V17 as RequestV17; use Appwrite\Utopia\Request\Filters\V18 as RequestV18; @@ -835,9 +834,6 @@ App::init() } } - // process on all databases endpoints! - $request->addFilter(new DatabaseAliases()); - $domain = $request->getHostname(); $domains = Config::getParam('domains', []); if (!array_key_exists($domain, $domains)) { From 3a8f097c173c2860aeb2b7f454839cf4545c678f Mon Sep 17 00:00:00 2001 From: Darshan Date: Tue, 6 May 2025 11:31:05 +0530 Subject: [PATCH 07/10] fix: realtime channels; update: row model. --- src/Appwrite/Messaging/Adapter/Realtime.php | 4 ++-- src/Appwrite/Utopia/Response/Model/Row.php | 7 ++++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/Appwrite/Messaging/Adapter/Realtime.php b/src/Appwrite/Messaging/Adapter/Realtime.php index 400589f677..2657ecccaa 100644 --- a/src/Appwrite/Messaging/Adapter/Realtime.php +++ b/src/Appwrite/Messaging/Adapter/Realtime.php @@ -312,8 +312,8 @@ class Realtime extends Adapter } $channels[] = 'rows'; - $channels[] = 'databases.' . $database->getId() . '.tables.' . $payload->getAttribute('$collectionId') . '.rows'; - $channels[] = 'databases.' . $database->getId() . '.tables.' . $payload->getAttribute('$collectionId') . '.rows.' . $payload->getId(); + $channels[] = 'databases.' . $database->getId() . '.tables.' . $payload->getAttribute('$tableId') . '.rows'; + $channels[] = 'databases.' . $database->getId() . '.tables.' . $payload->getAttribute('$tableId') . '.rows.' . $payload->getId(); $roles = $table->getAttribute('documentSecurity', false) ? \array_merge($table->getRead(), $payload->getRead()) diff --git a/src/Appwrite/Utopia/Response/Model/Row.php b/src/Appwrite/Utopia/Response/Model/Row.php index 49325bdc81..c84a81738d 100644 --- a/src/Appwrite/Utopia/Response/Model/Row.php +++ b/src/Appwrite/Utopia/Response/Model/Row.php @@ -36,7 +36,7 @@ class Row extends Any 'default' => '', 'example' => '5e5ea5c16897e', ]) - ->addRule('$collectionId', [ + ->addRule('$tableId', [ 'type' => self::TYPE_STRING, 'description' => 'Table ID.', 'default' => '', @@ -75,6 +75,11 @@ class Row extends Any $document->removeAttribute('$collection'); $document->removeAttribute('$tenant'); + $collectionId = $document->getAttribute('$collectionId'); + $document + ->removeAttribute('$collectionId') + ->setAttribute('$tableId', $collectionId); + foreach ($document->getAttributes() as $column) { if (\is_array($column)) { foreach ($column as $subAttribute) { From 86d195c1c0a49d7c351dac4e9dfd9be4defb9f7c Mon Sep 17 00:00:00 2001 From: Darshan Date: Tue, 6 May 2025 11:31:35 +0530 Subject: [PATCH 08/10] update: request, response filters. --- src/Appwrite/Utopia/Request/Filters/V19.php | 32 +++++++++++++++----- src/Appwrite/Utopia/Response/Filters/V19.php | 2 ++ 2 files changed, 26 insertions(+), 8 deletions(-) diff --git a/src/Appwrite/Utopia/Request/Filters/V19.php b/src/Appwrite/Utopia/Request/Filters/V19.php index ee04cea038..01d2da01a2 100644 --- a/src/Appwrite/Utopia/Request/Filters/V19.php +++ b/src/Appwrite/Utopia/Request/Filters/V19.php @@ -6,20 +6,36 @@ use Appwrite\Utopia\Request\Filter; class V19 extends Filter { + // Map old params to new + private const PARAMS_MAP = [ + 'documentId' => 'rowId', + 'attributes' => 'columns', + 'collectionId' => 'tableId', + 'attributeId' => 'columnId', + '$collectionId' => '$tableId', + 'relatedCollection' => 'relatedTable', + 'relatedCollectionId' => 'relatedTableId', + ]; + // Convert 1.6 params to 1.7 public function parse(array $content, string $model): array { - return match ($model) { - 'databases.createRelationshipColumn' => $this->convertV16RelationshipParams($content), - default => $content - }; + $content = $this->overrideDatabaseParams($content, $model); + + return $content; } - protected function convertV16RelationshipParams(array $content): array + protected function overrideDatabaseParams(array $content, string $model): array { - if (isset($content['relatedCollectionId'])) { - $content['relatedTableId'] = $content['relatedCollectionId']; - unset($content['relatedCollectionId']); + if (!str_starts_with($model, 'databases.')) { + return $content; + } + + $intersect = array_intersect_key(self::PARAMS_MAP, $content); + + foreach ($intersect as $oldKey => $newKey) { + $content[$newKey] = $content[$oldKey]; + unset($content[$oldKey]); } return $content; diff --git a/src/Appwrite/Utopia/Response/Filters/V19.php b/src/Appwrite/Utopia/Response/Filters/V19.php index 5e1a7e40e7..24cb07889f 100644 --- a/src/Appwrite/Utopia/Response/Filters/V19.php +++ b/src/Appwrite/Utopia/Response/Filters/V19.php @@ -10,8 +10,10 @@ class V19 extends Filter private const DATABASE_MAPPINGS = [ 'table' => 'collection', 'tables' => 'collections', + '$tableId' => '$collectionId', 'tablesTotal' => 'collectionsTotal', 'relatedTable' => 'relatedCollection', + 'relatedTableId' => 'relatedCollectionId', 'column' => 'attribute', 'columns' => 'attributes', From 9ec897f7d606ca7c431655a0fadbfe9e3f14ff63 Mon Sep 17 00:00:00 2001 From: Darshan Date: Tue, 6 May 2025 12:05:06 +0530 Subject: [PATCH 09/10] fix: filtering --- src/Appwrite/Utopia/Response/Model/Row.php | 10 +++--- .../e2e/Services/Databases/DatabasesBase.php | 31 ++++++++++--------- 2 files changed, 22 insertions(+), 19 deletions(-) diff --git a/src/Appwrite/Utopia/Response/Model/Row.php b/src/Appwrite/Utopia/Response/Model/Row.php index c84a81738d..c30984ab7a 100644 --- a/src/Appwrite/Utopia/Response/Model/Row.php +++ b/src/Appwrite/Utopia/Response/Model/Row.php @@ -75,10 +75,12 @@ class Row extends Any $document->removeAttribute('$collection'); $document->removeAttribute('$tenant'); - $collectionId = $document->getAttribute('$collectionId'); - $document - ->removeAttribute('$collectionId') - ->setAttribute('$tableId', $collectionId); + $collectionId = $document->getAttribute('$collectionId', ''); + if (!empty($collectionId)) { + $document + ->removeAttribute('$collectionId') + ->setAttribute('$tableId', $collectionId); + } foreach ($document->getAttributes() as $column) { if (\is_array($column)) { diff --git a/tests/e2e/Services/Databases/DatabasesBase.php b/tests/e2e/Services/Databases/DatabasesBase.php index 3df5dd4387..186f906252 100644 --- a/tests/e2e/Services/Databases/DatabasesBase.php +++ b/tests/e2e/Services/Databases/DatabasesBase.php @@ -1542,7 +1542,7 @@ trait DatabasesBase ]); $this->assertEquals(201, $document1['headers']['status-code']); - $this->assertEquals($data['moviesId'], $document1['body']['$collectionId']); + $this->assertEquals($data['moviesId'], $document1['body']['$tableId']); $this->assertArrayNotHasKey('$collection', $document1['body']); $this->assertEquals($databaseId, $document1['body']['$databaseId']); $this->assertEquals($document1['body']['title'], 'Captain America'); @@ -1555,7 +1555,7 @@ trait DatabasesBase $this->assertEquals($document1['body']['birthDay'], '1975-06-12T12:12:55.000+00:00'); $this->assertEquals(201, $document2['headers']['status-code']); - $this->assertEquals($data['moviesId'], $document2['body']['$collectionId']); + $this->assertEquals($data['moviesId'], $document2['body']['$tableId']); $this->assertArrayNotHasKey('$collection', $document2['body']); $this->assertEquals($databaseId, $document2['body']['$databaseId']); $this->assertEquals($document2['body']['title'], 'Spider-Man: Far From Home'); @@ -1572,7 +1572,7 @@ trait DatabasesBase $this->assertEquals($document2['body']['integers'][1], 60); $this->assertEquals(201, $document3['headers']['status-code']); - $this->assertEquals($data['moviesId'], $document3['body']['$collectionId']); + $this->assertEquals($data['moviesId'], $document3['body']['$tableId']); $this->assertArrayNotHasKey('$collection', $document3['body']); $this->assertEquals($databaseId, $document3['body']['$databaseId']); $this->assertEquals($document3['body']['title'], 'Spider-Man: Homecoming'); @@ -1621,7 +1621,8 @@ trait DatabasesBase $this->assertCount(3, $documents['body']['rows']); foreach ($documents['body']['rows'] as $document) { - $this->assertEquals($data['moviesId'], $document['$collectionId']); + print_r($document); + $this->assertEquals($data['moviesId'], $document['$tableId']); $this->assertArrayNotHasKey('$collection', $document); $this->assertEquals($databaseId, $document['$databaseId']); } @@ -1696,14 +1697,14 @@ trait DatabasesBase { $databaseId = $data['databaseId']; foreach ($data['rows'] as $document) { - $response = $this->client->call(Client::METHOD_GET, '/databases/' . $databaseId . '/collections/' . $document['$collectionId'] . '/documents/' . $document['$id'], array_merge([ + $response = $this->client->call(Client::METHOD_GET, '/databases/' . $databaseId . '/collections/' . $document['$tableId'] . '/documents/' . $document['$id'], array_merge([ 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], ], $this->getHeaders())); $this->assertEquals(200, $response['headers']['status-code']); $this->assertEquals($response['body']['$id'], $document['$id']); - $this->assertEquals($document['$collectionId'], $response['body']['$collectionId']); + $this->assertEquals($document['$tableId'], $response['body']['$tableId']); $this->assertArrayNotHasKey('$collection', $response['body']); $this->assertEquals($document['$databaseId'], $response['body']['$databaseId']); $this->assertEquals($response['body']['title'], $document['title']); @@ -1723,7 +1724,7 @@ trait DatabasesBase $databaseId = $data['databaseId']; $document = $data['rows'][0]; - $response = $this->client->call(Client::METHOD_GET, '/databases/' . $databaseId . '/collections/' . $document['$collectionId'] . '/documents/' . $document['$id'], array_merge([ + $response = $this->client->call(Client::METHOD_GET, '/databases/' . $databaseId . '/collections/' . $document['$tableId'] . '/documents/' . $document['$id'], array_merge([ 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], ], $this->getHeaders()), [ @@ -2305,7 +2306,7 @@ trait DatabasesBase $id = $document['body']['$id']; $this->assertEquals(201, $document['headers']['status-code']); - $this->assertEquals($data['moviesId'], $document['body']['$collectionId']); + $this->assertEquals($data['moviesId'], $document['body']['$tableId']); $this->assertArrayNotHasKey('$collection', $document['body']); $this->assertEquals($databaseId, $document['body']['$databaseId']); $this->assertEquals($document['body']['title'], 'Thor: Ragnaroc'); @@ -2333,7 +2334,7 @@ trait DatabasesBase $this->assertEquals(200, $document['headers']['status-code']); $this->assertEquals($document['body']['$id'], $id); - $this->assertEquals($data['moviesId'], $document['body']['$collectionId']); + $this->assertEquals($data['moviesId'], $document['body']['$tableId']); $this->assertArrayNotHasKey('$collection', $document['body']); $this->assertEquals($databaseId, $document['body']['$databaseId']); $this->assertEquals($document['body']['title'], 'Thor: Ragnarok'); @@ -2350,7 +2351,7 @@ trait DatabasesBase $id = $document['body']['$id']; $this->assertEquals(200, $document['headers']['status-code']); - $this->assertEquals($data['moviesId'], $document['body']['$collectionId']); + $this->assertEquals($data['moviesId'], $document['body']['$tableId']); $this->assertArrayNotHasKey('$collection', $document['body']); $this->assertEquals($databaseId, $document['body']['$databaseId']); $this->assertEquals($document['body']['title'], 'Thor: Ragnarok'); @@ -4000,8 +4001,8 @@ trait DatabasesBase $this->assertEquals($databaseId, $person1['body']['$databaseId']); $this->assertEquals($databaseId, $person1['body']['library']['$databaseId']); - $this->assertEquals($person['body']['$id'], $person1['body']['$collectionId']); - $this->assertEquals($library['body']['$id'], $person1['body']['library']['$collectionId']); + $this->assertEquals($person['body']['$id'], $person1['body']['$tableId']); + $this->assertEquals($library['body']['$id'], $person1['body']['library']['$tableId']); $this->assertArrayNotHasKey('$collection', $person1['body']); $this->assertArrayNotHasKey('$collection', $person1['body']['library']); @@ -4562,7 +4563,7 @@ trait DatabasesBase $this->assertEquals(null, $response['body']['rows'][0]['fullName']); $this->assertArrayNotHasKey("libraries", $response['body']['rows'][0]); $this->assertArrayNotHasKey('$databaseId', $response['body']['rows'][0]); - $this->assertArrayNotHasKey('$collectionId', $response['body']['rows'][0]); + $this->assertArrayNotHasKey('$tableId', $response['body']['rows'][0]); } /** @@ -4583,7 +4584,7 @@ trait DatabasesBase $this->assertEquals(200, $response['headers']['status-code']); $this->assertArrayNotHasKey('libraries', $response['body']['rows'][0]); $this->assertArrayNotHasKey('$databaseId', $response['body']['rows'][0]); - $this->assertArrayNotHasKey('$collectionId', $response['body']['rows'][0]); + $this->assertArrayNotHasKey('$tableId', $response['body']['rows'][0]); $response = $this->client->call(Client::METHOD_GET, '/databases/' . $data['databaseId'] . '/collections/' . $data['personCollection'] . '/documents', array_merge([ 'content-type' => 'application/json', @@ -4597,7 +4598,7 @@ trait DatabasesBase $this->assertEquals(200, $response['headers']['status-code']); $this->assertArrayHasKey('libraries', $document); $this->assertArrayNotHasKey('$databaseId', $document); - $this->assertArrayNotHasKey('$collectionId', $document); + $this->assertArrayNotHasKey('$tableId', $document); $response = $this->client->call(Client::METHOD_GET, '/databases/' . $data['databaseId'] . '/collections/' . $data['personCollection'] . '/documents/' . $document['$id'], array_merge([ 'content-type' => 'application/json', From b1735ef9452a9a16baaa55d4fe6c488b3149dcb5 Mon Sep 17 00:00:00 2001 From: Darshan Date: Tue, 6 May 2025 12:14:54 +0530 Subject: [PATCH 10/10] remove: aliasing filter. --- .../Request/Filters/DatabaseAliases.php | 39 ------------------- 1 file changed, 39 deletions(-) delete mode 100644 src/Appwrite/Utopia/Request/Filters/DatabaseAliases.php diff --git a/src/Appwrite/Utopia/Request/Filters/DatabaseAliases.php b/src/Appwrite/Utopia/Request/Filters/DatabaseAliases.php deleted file mode 100644 index 0ee2754475..0000000000 --- a/src/Appwrite/Utopia/Request/Filters/DatabaseAliases.php +++ /dev/null @@ -1,39 +0,0 @@ - 'rowId', - 'attributes' => 'columns', - 'collectionId' => 'tableId', - 'attributeId' => 'columnId', - 'relatedCollection' => 'relatedTable', - 'relatedCollectionId' => 'relatedTableId', - ]; - - public function parse(array $content, string $model): array - { - return $this->overrideDatabaseParams($content, $model); - } - - protected function overrideDatabaseParams(array $content, string $model): array - { - if (!str_starts_with($model, 'databases.')) { - return $content; - } - - $intersect = array_intersect_key(self::PARAMS_MAP, $content); - - foreach ($intersect as $oldKey => $newKey) { - $content[$newKey] = $content[$oldKey]; - unset($content[$oldKey]); - } - - return $content; - } -}