Skip to content

Commit

Permalink
Check index length for big int
Browse files Browse the repository at this point in the history
  • Loading branch information
fogelito committed Nov 14, 2024
1 parent 5e54e78 commit a8d3f8d
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/Database/Validator/Index.php
Original file line number Diff line number Diff line change
Expand Up @@ -185,10 +185,17 @@ public function checkIndexLength(Document $index): bool
$attributeSize = $attribute->getAttribute('size', 0);
$indexLength = $lengths[$attributePosition] ?? $attributeSize;
break;

case Database::VAR_FLOAT:
$attributeSize = 2; // 8 bytes / 4 mb4
$indexLength = 2;
break;

case Database::VAR_INTEGER:
$attributeSize = $attribute->getAttribute('size', 0);
$indexLength = $attributeSize = $attributeSize >= 8 ? 2 : 1; // bigint
break;

default:
$attributeSize = 1; // 4 bytes / 4 mb4
$indexLength = 1;
Expand Down

0 comments on commit a8d3f8d

Please sign in to comment.