From 73c464a2c9b6459037abc1c73ebae6d64d32ea42 Mon Sep 17 00:00:00 2001 From: Prem Palanisamy Date: Fri, 13 Mar 2026 10:19:00 +0000 Subject: [PATCH] Add missing bucket and function migration properties Add transformations property to Bucket migration and commands, logging, scopes, specification properties to Function migration for both source export and destination import. --- src/Migration/Destinations/Appwrite.php | 9 ++++- src/Migration/Resources/Functions/Func.php | 43 +++++++++++++++++++++- src/Migration/Resources/Storage/Bucket.php | 11 +++++- src/Migration/Sources/Appwrite.php | 8 +++- 4 files changed, 65 insertions(+), 6 deletions(-) diff --git a/src/Migration/Destinations/Appwrite.php b/src/Migration/Destinations/Appwrite.php index 05c62470..0d0e7d64 100644 --- a/src/Migration/Destinations/Appwrite.php +++ b/src/Migration/Destinations/Appwrite.php @@ -1141,7 +1141,8 @@ public function importFileResource(Resource $resource): Resource $resource->getAllowedFileExtensions(), $compression, $resource->getEncryption(), - $resource->getAntiVirus() + $resource->getAntiVirus(), + $resource->getTransformations() ); $resource->setId($response['$id']); @@ -1462,7 +1463,11 @@ public function importFunctionResource(Resource $resource): Resource $resource->getSchedule(), $resource->getTimeout(), $resource->getEnabled(), - entrypoint: $resource->getEntrypoint(), + $resource->getLogging(), + $resource->getEntrypoint(), + $resource->getCommands(), + $resource->getScopes(), + specification: $resource->getSpecification() ?: null, ); break; case Resource::TYPE_ENVIRONMENT_VARIABLE: diff --git a/src/Migration/Resources/Functions/Func.php b/src/Migration/Resources/Functions/Func.php index 930f9219..ef5e6934 100644 --- a/src/Migration/Resources/Functions/Func.php +++ b/src/Migration/Resources/Functions/Func.php @@ -18,6 +18,10 @@ class Func extends Resource * @param int $timeout * @param string $activeDeployment * @param string $entrypoint + * @param string $commands + * @param bool $logging + * @param array $scopes + * @param string $specification */ public function __construct( string $id, @@ -29,7 +33,11 @@ public function __construct( private readonly string $schedule = '', private readonly int $timeout = 0, private readonly string $activeDeployment = '', - private readonly string $entrypoint = '' + private readonly string $entrypoint = '', + private readonly string $commands = '', + private readonly bool $logging = true, + private readonly array $scopes = [], + private readonly string $specification = '' ) { $this->id = $id; } @@ -50,7 +58,11 @@ public static function fromArray(array $array): self $array['schedule'] ?? '', $array['timeout'] ?? 0, $array['activeDeployment'] ?? '', - $array['entrypoint'] ?? '' + $array['entrypoint'] ?? '', + $array['commands'] ?? '', + $array['logging'] ?? true, + $array['scopes'] ?? [], + $array['specification'] ?? '' ); } @@ -70,6 +82,10 @@ public function jsonSerialize(): array 'timeout' => $this->timeout, 'activeDeployment' => $this->activeDeployment, 'entrypoint' => $this->entrypoint, + 'commands' => $this->commands, + 'logging' => $this->logging, + 'scopes' => $this->scopes, + 'specification' => $this->specification, ]; } @@ -133,4 +149,27 @@ public function getEntrypoint(): string { return $this->entrypoint; } + + public function getCommands(): string + { + return $this->commands; + } + + public function getLogging(): bool + { + return $this->logging; + } + + /** + * @return array + */ + public function getScopes(): array + { + return $this->scopes; + } + + public function getSpecification(): string + { + return $this->specification; + } } diff --git a/src/Migration/Resources/Storage/Bucket.php b/src/Migration/Resources/Storage/Bucket.php index cd6fdf06..a667ffdc 100644 --- a/src/Migration/Resources/Storage/Bucket.php +++ b/src/Migration/Resources/Storage/Bucket.php @@ -19,6 +19,7 @@ class Bucket extends Resource * @param bool $encryption * @param bool $antiVirus * @param bool $updateLimits + * @param bool $transformations */ public function __construct( string $id = '', @@ -32,6 +33,7 @@ public function __construct( private readonly bool $encryption = false, private readonly bool $antiVirus = false, private readonly bool $updateLimits = false, + private readonly bool $transformations = false, ) { $this->id = $id; $this->permissions = $permissions; @@ -54,7 +56,8 @@ public static function fromArray(array $array): self $array['compression'] ?? 'none', $array['encryption'] ?? false, $array['antiVirus'] ?? false, - $array['updateLimits'] ?? false + $array['updateLimits'] ?? false, + $array['transformations'] ?? false ); } @@ -74,6 +77,7 @@ public function jsonSerialize(): array 'encryption' => $this->encryption, 'antiVirus' => $this->antiVirus, 'updateLimits' => $this->updateLimits, + 'transformations' => $this->transformations, ]; } @@ -131,4 +135,9 @@ public function getAntiVirus(): bool { return $this->antiVirus; } + + public function getTransformations(): bool + { + return $this->transformations; + } } diff --git a/src/Migration/Sources/Appwrite.php b/src/Migration/Sources/Appwrite.php index 4de9c1bb..e5e57fa9 100644 --- a/src/Migration/Sources/Appwrite.php +++ b/src/Migration/Sources/Appwrite.php @@ -1252,6 +1252,8 @@ private function exportBuckets(int $batchSize): void $bucket['compression'], $bucket['encryption'], $bucket['antivirus'], + false, + $bucket['transformations'] ?? false, ); $convertedBuckets[] = $bucket; } @@ -1462,7 +1464,11 @@ private function exportFunctions(int $batchSize): void $function['schedule'], $function['timeout'], $function['deploymentId'] ?? '', - $function['entrypoint'] + $function['entrypoint'], + $function['commands'] ?? '', + $function['logging'] ?? true, + $function['scopes'] ?? [], + $function['specification'] ?? '', ); $functions[] = $convertedFunc;