Skip to content

Commit 102ee1d

Browse files
Merge pull request #90 from utopia-php/fix-default-id-padding
Fix: default to 20-char uniqids
2 parents 8ae0eb4 + dba8677 commit 102ee1d

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

src/Database/Database.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1180,7 +1180,7 @@ protected function decodeAttribute(string $name, $value, Document $document)
11801180
*
11811181
* @return string
11821182
*/
1183-
public function getId(int $padding = 0): string
1183+
public function getId(int $padding = 7): string
11841184
{
11851185
$uniqid = \uniqid();
11861186

tests/Database/Base.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1683,7 +1683,7 @@ public function testGetIndexLimit()
16831683

16841684
public function testGetId()
16851685
{
1686-
$this->assertEquals(13, strlen($this->getDatabase()->getId()));
1686+
$this->assertEquals(20, strlen($this->getDatabase()->getId()));
16871687
$this->assertEquals(13, strlen($this->getDatabase()->getId(0)));
16881688
$this->assertEquals(13, strlen($this->getDatabase()->getId(-1)));
16891689
$this->assertEquals(23, strlen($this->getDatabase()->getId(10)));

0 commit comments

Comments
 (0)