From acaf2f7900337462711c09a0eeb0f17963b53696 Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Fri, 1 May 2026 14:25:54 +1200 Subject: [PATCH] fix(migrations): drop response-model legacy fallback MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The Migration response model split legacy composite resourceId at read time so brand-new SDKs would see a clean shape on docs that hadn't been backfilled by V25 yet. That window is short (V25 runs on every 1.9.4 boot), so the worker fallback alone is enough. Old SDK clients still get the composite shape via the V25 response filter; the worker still tolerates legacy docs via resolveResourceIds(). This change only removes the in-window normalization for new SDKs reading not-yet-backfilled docs — they'll see resourceId="db:col" with empty parentResourceId for the few seconds V25 is running, then it's correct. Co-Authored-By: Claude Opus 4.7 (1M context) --- .../Utopia/Response/Model/Migration.php | 32 ------------------- 1 file changed, 32 deletions(-) diff --git a/src/Appwrite/Utopia/Response/Model/Migration.php b/src/Appwrite/Utopia/Response/Model/Migration.php index 77fef02901..0fbf7362b7 100644 --- a/src/Appwrite/Utopia/Response/Model/Migration.php +++ b/src/Appwrite/Utopia/Response/Model/Migration.php @@ -152,8 +152,6 @@ class Migration extends Model public function filter(Document $document): Document { - $this->normalizeLegacyResourceId($document); - $errors = $document->getAttribute('errors', []); if (empty($errors)) { return $document; @@ -174,34 +172,4 @@ class Migration extends Model return $document; } - - /** - * Splits a legacy "{databaseId}:{tableId}" resourceId into resourceId / - * parentResourceId for documents that haven't been backfilled by V25 yet - * (or that were just restored from a pre-1.9.4 backup). The new attributes - * stay populated where they already are; this only fills gaps. - */ - private function normalizeLegacyResourceId(Document $document): void - { - $resourceId = (string) $document->getAttribute('resourceId', ''); - $parentResourceId = (string) $document->getAttribute('parentResourceId', ''); - - if ($parentResourceId !== '' || !\str_contains($resourceId, ':')) { - return; - } - - [$databaseId, $tableId] = \explode(':', $resourceId, 2); - - $document->setAttribute('resourceId', $tableId); - $document->setAttribute('parentResourceId', $databaseId); - - // Pre-1.9.4 docs stored the database family ("database" / "documentsdb" - // / "vectorsdb") in resourceType. Promote it to parentResourceType and - // surface the leaf type so the response shape is consistent. - $legacyType = (string) $document->getAttribute('resourceType', ''); - if ((string) $document->getAttribute('parentResourceType', '') === '' && $legacyType !== '') { - $document->setAttribute('parentResourceType', $legacyType); - $document->setAttribute('resourceType', 'collection'); - } - } }