From 3333031433db716243bb2bef2b6808a4d4502544 Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Thu, 18 Dec 2025 23:31:10 +1300 Subject: [PATCH] Map float --- .../Http/Databases/Collections/Create.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Create.php index 724f40f00e..3e739c6f01 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Create.php @@ -123,6 +123,14 @@ class Create extends Action $collectionKey = 'database_' . $database->getSequence() . '_collection_' . $collection->getSequence(); $databaseKey = 'database_' . $database->getSequence(); + // Map 'float' to 'double' (Database::VAR_FLOAT) before validation + $attributes = array_map(function ($attr) { + if (isset($attr['type']) && $attr['type'] === 'float') { + $attr['type'] = Database::VAR_FLOAT; + } + return $attr; + }, $attributes); + $attributesValidator = new AttributesValidator( APP_LIMIT_ARRAY_PARAMS_SIZE, $dbForProject->getAdapter()->getSupportForSpatialAttributes() @@ -236,6 +244,12 @@ class Create extends Action $dbForProject->purgeCachedDocument('database_' . $database->getSequence(), $collection->getId()); $dbForProject->purgeCachedCollection('database_' . $database->getSequence() . '_collection_' . $collection->getSequence()); + // Set attributes and indexes on the collection document for the response + // Use the full database documents for attributes (they have status and other fields needed for response models) + // Use the simpler collection documents for indexes (they have the basic fields without internal tracking) + $collection->setAttribute('attributes', $attributeDocuments); + $collection->setAttribute('indexes', $collectionIndexes); + $queueForEvents ->setContext('database', $database) ->setParam('databaseId', $databaseId)