Skip to content

Commit

Permalink
Revert since used in Appwrite
Browse files Browse the repository at this point in the history
  • Loading branch information
fogelito committed Jan 15, 2025
1 parent 2915de1 commit 18f74a2
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/Database/Database.php
Original file line number Diff line number Diff line change
Expand Up @@ -5910,6 +5910,21 @@ private function validateSelections(Document $collection, array $queries): array
return $selections;
}

/**
* Get adapter attribute limit, accounting for internal metadata
* Returns 0 to indicate no limit
*
* @return int
*/
public function getLimitForAttributes(): int
{
if ($this->adapter->getLimitForAttributes() === 0) {
return 0;
}

return $this->adapter->getLimitForAttributes() - $this->adapter->getCountOfDefaultAttributes();
}

/**
* Get adapter index limit
*
Expand Down
5 changes: 5 additions & 0 deletions tests/e2e/Adapter/Base.php
Original file line number Diff line number Diff line change
Expand Up @@ -5736,6 +5736,11 @@ public function testUniqueIndexDuplicateUpdate(): void
static::getDatabase()->updateDocument('movies', $document->getId(), $document->setAttribute('name', 'Frozen'));
}

public function testGetAttributeLimit(): void
{
$this->assertIsInt($this->getDatabase()->getLimitForAttributes());
}

public function testGetIndexLimit(): void
{
$this->assertEquals(58, $this->getDatabase()->getLimitForIndexes());
Expand Down

0 comments on commit 18f74a2

Please sign in to comment.