Skip to content

Commit f84590d

Browse files
committed
Reapply "revert: remove extra Sequence validator changes that break MariaDB shared tables"
This reverts commit 906c03e.
1 parent dbf2f7a commit f84590d

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

src/Database/Database.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6054,7 +6054,7 @@ public function updateDocument(string $collection, string $id, Document $documen
60546054
$document['$createdAt'] = ($createdAt === null || !$this->preserveDates) ? $old->getCreatedAt() : $createdAt;
60556055

60566056
if ($this->adapter->getSharedTables()) {
6057-
$document['$tenant'] = $old->getAttribute('$tenant'); // Make sure user doesn't switch tenant
6057+
$document['$tenant'] = $old->getTenant(); // Make sure user doesn't switch tenant
60586058
}
60596059
$document = new Document($document);
60606060

src/Database/Validator/Sequence.php

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,17 +41,13 @@ public function isValid($value): bool
4141
return false;
4242
}
4343

44-
if (!\is_string($value) && !\is_int($value)) {
44+
if (!\is_string($value)) {
4545
return false;
4646
}
4747

4848
switch ($this->idAttributeType) {
49-
case Database::VAR_UUID7:
50-
if (\is_string($value) && preg_match('/^[a-f0-9]{8}-[a-f0-9]{4}-7[a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}$/i', $value) === 1) {
51-
return true;
52-
}
53-
// Also accept integer IDs (e.g. $tenant may be an integer in any adapter)
54-
// no break
49+
case Database::VAR_UUID7: //UUID7
50+
return preg_match('/^[a-f0-9]{8}-[a-f0-9]{4}-7[a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}$/i', $value) === 1;
5551
case Database::VAR_INTEGER:
5652
$start = ($this->primary) ? 1 : 0;
5753
$validator = new Range($start, Database::MAX_BIG_INT, Database::VAR_INTEGER);

0 commit comments

Comments
 (0)