Merge pull request #11071 from appwrite/fix-missing-dbId

This commit is contained in:
Darshan 2026-01-04 12:37:54 +05:30 committed by GitHub
commit d4660a70c3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 10 additions and 0 deletions

View file

@ -177,6 +177,7 @@ class Decrement extends Action
value: $value,
min: $min
);
$document->setAttribute('$databaseId', $database->getId());
$document->setAttribute('$' . $this->getCollectionsEventsContext() . 'Id', $collectionId);
} catch (ConflictException) {
throw new Exception($this->getConflictException());

View file

@ -177,6 +177,7 @@ class Increment extends Action
value: $value,
max: $max
);
$document->setAttribute('$databaseId', $database->getId());
$document->setAttribute('$' . $this->getCollectionsEventsContext() . 'Id', $collectionId);
} catch (ConflictException) {
throw new Exception($this->getConflictException());

View file

@ -6119,6 +6119,7 @@ trait DatabasesBase
$this->assertEquals(200, $inc['headers']['status-code']);
$this->assertEquals(6, $inc['body']['count']);
$this->assertEquals($collectionId, $inc['body']['$collectionId']);
$this->assertEquals($databaseId, $inc['body']['$databaseId']);
// Verify count = 6
$get = $this->client->call(Client::METHOD_GET, "/databases/$databaseId/collections/$collectionId/documents/$docId", array_merge([
@ -6231,6 +6232,7 @@ trait DatabasesBase
$this->assertEquals(200, $dec['headers']['status-code']);
$this->assertEquals(9, $dec['body']['count']);
$this->assertEquals($collectionId, $dec['body']['$collectionId']);
$this->assertEquals($databaseId, $dec['body']['$databaseId']);
$get = $this->client->call(Client::METHOD_GET, '/databases/' . $databaseId . '/collections/' . $collectionId . '/documents/' . $documentId, array_merge([
'content-type' => 'application/json',

View file

@ -3827,6 +3827,7 @@ trait TransactionsBase
$this->assertArrayHasKey('$collectionId', $decrementResponse['body'], 'Response should contain $collectionId for Collections API');
$this->assertArrayNotHasKey('$tableId', $decrementResponse['body'], 'Response should not contain $tableId for Collections API');
$this->assertEquals($collectionId, $decrementResponse['body']['$collectionId']);
$this->assertEquals($databaseId, $decrementResponse['body']['$databaseId']);
// Test increment endpoint
$incrementResponse = $this->client->call(
@ -3846,6 +3847,7 @@ trait TransactionsBase
$this->assertArrayHasKey('$collectionId', $incrementResponse['body'], 'Response should contain $collectionId for Collections API');
$this->assertArrayNotHasKey('$tableId', $incrementResponse['body'], 'Response should not contain $tableId for Collections API');
$this->assertEquals($collectionId, $incrementResponse['body']['$collectionId']);
$this->assertEquals($databaseId, $incrementResponse['body']['$databaseId']);
// Commit transaction - this will fail if transaction log has 'column' instead of 'attribute'
$commitResponse = $this->client->call(Client::METHOD_PATCH, "/databases/transactions/{$transactionId}", array_merge([

View file

@ -7761,6 +7761,7 @@ trait DatabasesBase
]));
$this->assertEquals(200, $inc['headers']['status-code']);
$this->assertEquals($tableId, $inc['body']['$tableId']);
$this->assertEquals($databaseId, $inc['body']['$databaseId']);
$this->assertEquals(6, $inc['body']['count']);
// Verify count = 6
@ -7874,6 +7875,7 @@ trait DatabasesBase
$this->assertEquals(200, $dec['headers']['status-code']);
$this->assertEquals(9, $dec['body']['count']);
$this->assertEquals($tableId, $dec['body']['$tableId']);
$this->assertEquals($databaseId, $dec['body']['$databaseId']);
$get = $this->client->call(Client::METHOD_GET, '/tablesdb/' . $databaseId . '/tables/' . $tableId . '/rows/' . $rowId, array_merge([
'content-type' => 'application/json',

View file

@ -3963,6 +3963,7 @@ trait TransactionsBase
$this->assertArrayHasKey('$tableId', $decrementResponse['body'], 'Response should contain $tableId for TablesDB API');
$this->assertArrayNotHasKey('$collectionId', $decrementResponse['body'], 'Response should not contain $collectionId for TablesDB API');
$this->assertEquals($tableId, $decrementResponse['body']['$tableId']);
$this->assertEquals($databaseId, $decrementResponse['body']['$databaseId']);
// Test increment endpoint
$incrementResponse = $this->client->call(
@ -3982,6 +3983,7 @@ trait TransactionsBase
$this->assertArrayHasKey('$tableId', $incrementResponse['body'], 'Response should contain $tableId for TablesDB API');
$this->assertArrayNotHasKey('$collectionId', $incrementResponse['body'], 'Response should not contain $collectionId for TablesDB API');
$this->assertEquals($tableId, $incrementResponse['body']['$tableId']);
$this->assertEquals($databaseId, $incrementResponse['body']['$databaseId']);
// Commit transaction - this will fail if transaction log has 'attribute' instead of 'column'
$commitResponse = $this->client->call(Client::METHOD_PATCH, "/tablesdb/transactions/{$transactionId}", array_merge([