Skip to content

Commit

Permalink
Remove Attribute Error catching and fix membership migration
Browse files Browse the repository at this point in the history
  • Loading branch information
PineappleIOnic committed Feb 23, 2024
1 parent 49b57a0 commit fd6612c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 12 deletions.
11 changes: 1 addition & 10 deletions src/Migration/Destinations/Appwrite.php
Original file line number Diff line number Diff line change
Expand Up @@ -288,15 +288,7 @@ public function importDatabaseResource(Resource $resource): Resource
break;
case Resource::TYPE_ATTRIBUTE:
/** @var Attribute $resource */
try {
$this->createAttribute($resource);
} catch (AppwriteException $e) {
if ($e->getType() === 'attribute_already_exists') {
$resource->setStatus(Resource::STATUS_SKIPPED, 'Attribute has been already created');
} else {
throw $e;
}
}
$this->createAttribute($resource);
break;
case Resource::TYPE_DOCUMENT:
/** @var Document $resource */
Expand All @@ -305,7 +297,6 @@ public function importDatabaseResource(Resource $resource): Resource

if ($docExists) {
$resource->setStatus(Resource::STATUS_SKIPPED, 'Document has been already created by relationship');

return $resource;
}

Expand Down
4 changes: 2 additions & 2 deletions src/Migration/Sources/Appwrite.php
Original file line number Diff line number Diff line change
Expand Up @@ -380,8 +380,6 @@ private function exportMemberships(int $batchSize)
{
$teamsClient = new Teams($this->client);

$lastDocument = null;

// Export Memberships
$cacheTeams = $this->cache->get(Team::getName());
/** @var array<string, User> - array where key is user ID */
Expand All @@ -393,6 +391,8 @@ private function exportMemberships(int $batchSize)

foreach ($cacheTeams as $team) {
/** @var Team $team */
$lastDocument = null;

while (true) {
$memberships = [];

Expand Down

0 comments on commit fd6612c

Please sign in to comment.