1
0
Fork 0
mirror of synced 2024-06-03 03:14:50 +12:00

fix: use bigint for large integers

This commit is contained in:
Torsten Dittmann 2021-12-29 15:50:21 +01:00
parent d8f71acc3f
commit 2015106702

View file

@ -973,10 +973,12 @@ App::post('/v1/database/collections/:collectionId/attributes/integer')
throw new Exception($validator->getDescription(), 400); throw new Exception($validator->getDescription(), 400);
} }
$size = $max > 2147483647 ? 8 : 4; // Automatically create BigInt depending on max value
$attribute = createAttribute($collectionId, new Document([ $attribute = createAttribute($collectionId, new Document([
'key' => $key, 'key' => $key,
'type' => Database::VAR_INTEGER, 'type' => Database::VAR_INTEGER,
'size' => 0, 'size' => $size,
'required' => $required, 'required' => $required,
'default' => $default, 'default' => $default,
'array' => $array, 'array' => $array,