Skip to content

Commit 73c464a

Browse files
committed
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.
1 parent 95dcbb9 commit 73c464a

File tree

4 files changed

+65
-6
lines changed

4 files changed

+65
-6
lines changed

src/Migration/Destinations/Appwrite.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1141,7 +1141,8 @@ public function importFileResource(Resource $resource): Resource
11411141
$resource->getAllowedFileExtensions(),
11421142
$compression,
11431143
$resource->getEncryption(),
1144-
$resource->getAntiVirus()
1144+
$resource->getAntiVirus(),
1145+
$resource->getTransformations()
11451146
);
11461147

11471148
$resource->setId($response['$id']);
@@ -1462,7 +1463,11 @@ public function importFunctionResource(Resource $resource): Resource
14621463
$resource->getSchedule(),
14631464
$resource->getTimeout(),
14641465
$resource->getEnabled(),
1465-
entrypoint: $resource->getEntrypoint(),
1466+
$resource->getLogging(),
1467+
$resource->getEntrypoint(),
1468+
$resource->getCommands(),
1469+
$resource->getScopes(),
1470+
specification: $resource->getSpecification() ?: null,
14661471
);
14671472
break;
14681473
case Resource::TYPE_ENVIRONMENT_VARIABLE:

src/Migration/Resources/Functions/Func.php

Lines changed: 41 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ class Func extends Resource
1818
* @param int $timeout
1919
* @param string $activeDeployment
2020
* @param string $entrypoint
21+
* @param string $commands
22+
* @param bool $logging
23+
* @param array<string> $scopes
24+
* @param string $specification
2125
*/
2226
public function __construct(
2327
string $id,
@@ -29,7 +33,11 @@ public function __construct(
2933
private readonly string $schedule = '',
3034
private readonly int $timeout = 0,
3135
private readonly string $activeDeployment = '',
32-
private readonly string $entrypoint = ''
36+
private readonly string $entrypoint = '',
37+
private readonly string $commands = '',
38+
private readonly bool $logging = true,
39+
private readonly array $scopes = [],
40+
private readonly string $specification = ''
3341
) {
3442
$this->id = $id;
3543
}
@@ -50,7 +58,11 @@ public static function fromArray(array $array): self
5058
$array['schedule'] ?? '',
5159
$array['timeout'] ?? 0,
5260
$array['activeDeployment'] ?? '',
53-
$array['entrypoint'] ?? ''
61+
$array['entrypoint'] ?? '',
62+
$array['commands'] ?? '',
63+
$array['logging'] ?? true,
64+
$array['scopes'] ?? [],
65+
$array['specification'] ?? ''
5466
);
5567
}
5668

@@ -70,6 +82,10 @@ public function jsonSerialize(): array
7082
'timeout' => $this->timeout,
7183
'activeDeployment' => $this->activeDeployment,
7284
'entrypoint' => $this->entrypoint,
85+
'commands' => $this->commands,
86+
'logging' => $this->logging,
87+
'scopes' => $this->scopes,
88+
'specification' => $this->specification,
7389
];
7490
}
7591

@@ -133,4 +149,27 @@ public function getEntrypoint(): string
133149
{
134150
return $this->entrypoint;
135151
}
152+
153+
public function getCommands(): string
154+
{
155+
return $this->commands;
156+
}
157+
158+
public function getLogging(): bool
159+
{
160+
return $this->logging;
161+
}
162+
163+
/**
164+
* @return array<string>
165+
*/
166+
public function getScopes(): array
167+
{
168+
return $this->scopes;
169+
}
170+
171+
public function getSpecification(): string
172+
{
173+
return $this->specification;
174+
}
136175
}

src/Migration/Resources/Storage/Bucket.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ class Bucket extends Resource
1919
* @param bool $encryption
2020
* @param bool $antiVirus
2121
* @param bool $updateLimits
22+
* @param bool $transformations
2223
*/
2324
public function __construct(
2425
string $id = '',
@@ -32,6 +33,7 @@ public function __construct(
3233
private readonly bool $encryption = false,
3334
private readonly bool $antiVirus = false,
3435
private readonly bool $updateLimits = false,
36+
private readonly bool $transformations = false,
3537
) {
3638
$this->id = $id;
3739
$this->permissions = $permissions;
@@ -54,7 +56,8 @@ public static function fromArray(array $array): self
5456
$array['compression'] ?? 'none',
5557
$array['encryption'] ?? false,
5658
$array['antiVirus'] ?? false,
57-
$array['updateLimits'] ?? false
59+
$array['updateLimits'] ?? false,
60+
$array['transformations'] ?? false
5861
);
5962
}
6063

@@ -74,6 +77,7 @@ public function jsonSerialize(): array
7477
'encryption' => $this->encryption,
7578
'antiVirus' => $this->antiVirus,
7679
'updateLimits' => $this->updateLimits,
80+
'transformations' => $this->transformations,
7781
];
7882
}
7983

@@ -131,4 +135,9 @@ public function getAntiVirus(): bool
131135
{
132136
return $this->antiVirus;
133137
}
138+
139+
public function getTransformations(): bool
140+
{
141+
return $this->transformations;
142+
}
134143
}

src/Migration/Sources/Appwrite.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1252,6 +1252,8 @@ private function exportBuckets(int $batchSize): void
12521252
$bucket['compression'],
12531253
$bucket['encryption'],
12541254
$bucket['antivirus'],
1255+
false,
1256+
$bucket['transformations'] ?? false,
12551257
);
12561258
$convertedBuckets[] = $bucket;
12571259
}
@@ -1462,7 +1464,11 @@ private function exportFunctions(int $batchSize): void
14621464
$function['schedule'],
14631465
$function['timeout'],
14641466
$function['deploymentId'] ?? '',
1465-
$function['entrypoint']
1467+
$function['entrypoint'],
1468+
$function['commands'] ?? '',
1469+
$function['logging'] ?? true,
1470+
$function['scopes'] ?? [],
1471+
$function['specification'] ?? '',
14661472
);
14671473
$functions[] = $convertedFunc;
14681474

0 commit comments

Comments
 (0)