Repository: appwrite/appwrite
File: src/Appwrite/Platform/Workers/Migrations.php (PHP)

Code before:
                             * @var Resource $resource
                            */
                            $resource = $resources[0];
                            $count = count($resources);
                            $databaseId = null;
                            $tableId = null;
                            switch ($resource->getName()) {
                                case ResourceTable::getName():
                                    /** @var ResourceTable $resource */
                                    $databaseId = $resource->getDatabase()->getSequence();
                                    break;
                                case ResourceRow::getName():
                                    /** @var ResourceRow $resource */
                                    $table = $resource->getTable();
                                    $databaseId = $table->getDatabase()->getSequence();
                                    $tableId = $table->getSequence();
                                    break;
                                default:
                                    break;
                            }
                            $aggregatedResources[] = [
                                "name" => $resource->getName(),
                                "count" => $count,
                                "databaseId" => $databaseId,
                                "tableId" => $tableId
                            ];

                        }
                        $this->updateMigrationDocument($migration, $projectDocument, $queueForRealtime);
                    },
                    $migration->getAttribute('resourceId'),
                    $migration->getAttribute('resourceType')
                );
            }

            $destination->shutDown();
            $source->shutDown();

            $sourceErrors = $source->getErrors();
            $destinationErrors = $destination->getErrors();

            if (! empty($sourceErrors) || ! empty($destinationErrors)) {
                $migration->setAttribute('status', 'failed');
                $migration->setAttribute('stage', 'finished');

                $errorMessages = [];
                foreach ($sourceErrors as $error) {
                    $errorMessages[] = json_encode($error);
                }
                foreach ($destinationErrors as $error) {
                    $errorMessages[] = json_encode($error);

Review comment (suggestion):
```suggestion
                            $aggregatedResources[] = [
                                'name' => $resource->getName(),
                                'count' => $count,
                                'databaseId' => $databaseId,
                                'tableId' => $tableId
                            ];
```

Code after:
                             * @var Resource $resource
                            */
                            $resource = $resources[0];
                            $count = count($resources);
                            $databaseId = null;
                            $tableId = null;
                            switch ($resource->getName()) {
                                case ResourceTable::getName():
                                    /** @var ResourceTable $resource */
                                    $databaseId = $resource->getDatabase()->getSequence();
                                    break;
                                case ResourceRow::getName():
                                    /** @var ResourceRow $resource */
                                    $table = $resource->getTable();
                                    $databaseId = $table->getDatabase()->getSequence();
                                    $tableId = $table->getSequence();
                                    break;
                                default:
                                    break;
                            }
                            $aggregatedResources[] = [
                                'name' => $resource->getName(),
                                'count' => $count,
                                'databaseId' => $databaseId,
                                'tableId' => $tableId
                            ];

                        }
                        $this->updateMigrationDocument($migration, $projectDocument, $queueForRealtime);
                    },
                    $migration->getAttribute('resourceId'),
                    $migration->getAttribute('resourceType')
                );
            }

            $destination->shutDown();
            $source->shutDown();

            $sourceErrors = $source->getErrors();
            $destinationErrors = $destination->getErrors();

            if (! empty($sourceErrors) || ! empty($destinationErrors)) {
                $migration->setAttribute('status', 'failed');
                $migration->setAttribute('stage', 'finished');

                $errorMessages = [];
                foreach ($sourceErrors as $error) {
                    $errorMessages[] = json_encode($error);
                }
                foreach ($destinationErrors as $error) {
                    $errorMessages[] = json_encode($error);