fix: remove duplicate database fetch, add null-safe queries fallback, add schemaless comment

This commit is contained in:
Prem Palanisamy
2026-03-30 14:55:05 +01:00
parent aaebeec61e
commit d8bbd82556
2 changed files with 4 additions and 5 deletions
+3 -4
View File
@@ -566,15 +566,12 @@ Http::post('/v1/migrations/csv/exports')
throw new Exception(Exception::COLLECTION_NOT_FOUND);
}
// getting databasetype
$resources = explode(':', $resourceId);
$databaseId = $resources[0];
$database = $authorization->skip(fn () => $dbForProject->getDocument('databases', $databaseId));
$databaseType = $database->getAttribute('type');
if (!in_array($databaseType, CSV_ALLOWED_DATABASE_TYPES)) {
throw new Exception(Exception::MIGRATION_DATABASE_TYPE_UNSUPPORTED, 'Database type not supported for csv');
}
// Schemaless databases (DocumentsDB, VectorsDB) allow queries on dynamic fields
$isSchemaless = in_array($databaseType, [DATABASE_TYPE_DOCUMENTSDB, DATABASE_TYPE_VECTORSDB]);
$validator = new Documents(
@@ -859,6 +856,8 @@ Http::post('/v1/migrations/json/exports')
}
$databaseType = $database->getAttribute('type');
// Schemaless databases (DocumentsDB, VectorsDB) allow queries on dynamic fields
$isSchemaless = in_array($databaseType, [DATABASE_TYPE_DOCUMENTSDB, DATABASE_TYPE_VECTORSDB]);
$validator = new Documents(
+1 -1
View File
@@ -211,7 +211,7 @@ class Migrations extends Action
$this->getDatabasesDBForProject($database);
$queries = [];
if ($source === SourceAppwrite::getName() && in_array($destination, [DestinationCSV::getName(), DestinationJSON::getName()])) {
$queries = Query::parseQueries($migrationOptions['queries']);
$queries = Query::parseQueries($migrationOptions['queries'] ?? []);
}
$migrationSource = match ($source) {