Skip to content

Commit 788ee3e

Browse files
added database type for migrating database type
1 parent 42ff497 commit 788ee3e

3 files changed

Lines changed: 10 additions & 1 deletion

File tree

src/Migration/Destinations/Appwrite.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,7 @@ protected function createDatabase(Database $resource): bool
338338
'$updatedAt' => $resource->getUpdatedAt(),
339339
'originalId' => empty($resource->getOriginalId()) ? null : $resource->getOriginalId(),
340340
'type' => empty($resource->getType()) ? 'legacy' : $resource->getType(),
341+
'database' => $resource->getDatabase()
341342
]));
342343

343344
$resource->setSequence($database->getSequence());

src/Migration/Resources/Database/Database.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ public function __construct(
2626
protected bool $enabled = true,
2727
protected string $originalId = '',
2828
protected string $type = '',
29+
protected string $database = ''
2930
) {
3031
$this->id = $id;
3132
}
@@ -50,6 +51,7 @@ public static function fromArray(array $array): self
5051
enabled: $array['enabled'] ?? true,
5152
originalId: $array['originalId'] ?? '',
5253
type: $array['type'] ?? 'legacy',
54+
database: $array['database']
5355
);
5456
}
5557

@@ -92,4 +94,9 @@ public function getType(): string
9294
{
9395
return $this->type;
9496
}
97+
98+
public function getDatabase(): string
99+
{
100+
return $this->database;
101+
}
95102
}

src/Migration/Sources/Appwrite.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -738,7 +738,8 @@ private function exportDatabases(int $batchSize): void
738738
$database['name'],
739739
$database['$createdAt'],
740740
$database['$updatedAt'],
741-
type: $database['type'] ?? 'legacy'
741+
type: $database['type'] ?? 'legacy',
742+
database: $database['database']
742743
);
743744

744745
$databases[] = $newDatabase;

0 commit comments

Comments
 (0)