Skip to content

Commit e86d529

Browse files
fix database type overwritten by the family type
1 parent bbdd8ef commit e86d529

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

src/Migration/Sources/Appwrite.php

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -850,18 +850,20 @@ private function exportDatabases(int $batchSize, array $resources = []): void
850850
$response = $this->reader->listDatabases($queries);
851851

852852
foreach ($response as $database) {
853-
$databaseType = $database['type'];
854-
if (in_array($databaseType, [Resource::TYPE_DATABASE_LEGACY,Resource::TYPE_DATABASE_TABLESDB])) {
855-
$databaseType = Resource::TYPE_DATABASE;
853+
$originalType = $database['type'] ?? Resource::TYPE_DATABASE_LEGACY;
854+
855+
$databaseFamilyType = $originalType;
856+
if (\in_array($databaseFamilyType, [Resource::TYPE_DATABASE_LEGACY, Resource::TYPE_DATABASE_TABLESDB], true)) {
857+
$databaseFamilyType = Resource::TYPE_DATABASE;
856858
}
857-
if (Resource::isSupported($databaseType, $resources)) {
858-
$newDatabase = self::getDatabase($databaseType, [
859+
860+
if (Resource::isSupported($databaseFamilyType, $resources)) {
861+
$newDatabase = self::getDatabase($databaseFamilyType, [
859862
'id' => $database['$id'],
860863
'name' => $database['name'],
861864
'createdAt' => $database['$createdAt'],
862865
'updatedAt' => $database['$updatedAt'],
863-
'enabled' => $database['enabled'] ?? true,
864-
'type' => $databaseType,
866+
'type' => $originalType,
865867
'database' => $database['database']
866868
]);
867869
$databases[] = $newDatabase;
@@ -931,7 +933,6 @@ private function exportEntities(string $databaseName, int $batchSize): void
931933
'permissions' => $table['$permissions'],
932934
'createdAt' => $table['$createdAt'],
933935
'updatedAt' => $table['$updatedAt'],
934-
'enabled' => $table['enabled'] ?? true,
935936
'database' => [
936937
'id' => $database->getId(),
937938
'name' => $database->getDatabaseName(),

0 commit comments

Comments
 (0)