Skip to content

Commit

Permalink
Add setPreserveDates
Browse files Browse the repository at this point in the history
  • Loading branch information
fogelito committed Sep 5, 2024
1 parent c527daf commit eccd83f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/Migration/Destinations/Appwrite.php
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,8 @@ protected function import(array $resources, callable $callback): void
$isLast = $index === $total - 1;

try {
$this->database->setPreserveDates(true);

$responseResource = match ($resource->getGroup()) {
Transfer::GROUP_DATABASES => $this->importDatabaseResource($resource, $isLast),
Transfer::GROUP_STORAGE => $this->importFileResource($resource),
Expand All @@ -247,6 +249,8 @@ protected function import(array $resources, callable $callback): void
}

$responseResource = $resource;
} finally {
$this->database->setPreserveDates(false);
}

$this->cache->update($responseResource);
Expand Down Expand Up @@ -888,14 +892,12 @@ protected function createDocument(Document $resource, bool $isLast): bool
$collectionInternalId = $collection->getInternalId();

$this->database
->setPreserveDates(true)
->createDocuments(
'database_' . $databaseInternalId . '_collection_' . $collectionInternalId,
$this->documentBuffer
);
} finally {
$this->documentBuffer = [];
$this->database->setPreserveDates(false);
}
}

Expand Down

0 comments on commit eccd83f

Please sign in to comment.