Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 1 addition & 9 deletions src/Migration/Destinations/Appwrite.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,6 @@ class Appwrite extends Destination
*/
protected $getDatabasesDB;

/**
* @var callable(string $databaseType):string
*/
protected $getDatabaseDSN;

/**
* @var array<UtopiaDocument>
*/
Expand All @@ -88,7 +83,6 @@ class Appwrite extends Destination
* @param string $key
* @param UtopiaDatabase $dbForProject
* @param callable(UtopiaDocument $database):UtopiaDatabase $getDatabasesDB
* @param callable(string $databaseType):string $getDatabaseDSN
* @param array<array<string, mixed>> $collectionStructure
*/
public function __construct(
Expand All @@ -97,7 +91,6 @@ public function __construct(
string $key,
protected UtopiaDatabase $dbForProject,
callable $getDatabasesDB,
callable $getDatabaseDSN,
protected array $collectionStructure
) {
$this->project = $project;
Expand All @@ -116,7 +109,6 @@ public function __construct(
$this->users = new Users($this->client);

$this->getDatabasesDB = $getDatabasesDB;
$this->getDatabaseDSN = $getDatabaseDSN;
}

public static function getName(): string
Expand Down Expand Up @@ -385,7 +377,7 @@ protected function createDatabase(Database $resource): bool
'originalId' => empty($resource->getOriginalId()) ? null : $resource->getOriginalId(),
'type' => empty($resource->getType()) ? 'legacy' : $resource->getType(),
// source and destination can be in different location
'database' => ($this->getDatabaseDSN)($resource->getType())
'database' => $resource->getDatabase()
]));

$resource->setSequence($database->getSequence());
Expand Down
1 change: 1 addition & 0 deletions src/Migration/Resources/Database/Database.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ public function jsonSerialize(): array
'updatedAt' => $this->updatedAt,
'enabled' => $this->enabled,
'type' => $this->type,
'database' => $this->database
];
}

Expand Down
4 changes: 2 additions & 2 deletions src/Migration/Resources/Database/DocumentsDB.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ public static function fromArray(array $array): self
updatedAt: $array['updatedAt'] ?? '',
enabled: $array['enabled'] ?? true,
originalId: $array['originalId'] ?? '',
type: $array['type'] ?? 'legacy',
database: $array['database'] ?? 'legacy'
type: $array['type'] ?? Resource::TYPE_DATABASE_DOCUMENTSDB,
database: $array['database']
);
}
}
4 changes: 2 additions & 2 deletions src/Migration/Resources/Database/VectorDB.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ public static function fromArray(array $array): self
updatedAt: $array['updatedAt'] ?? '',
enabled: $array['enabled'] ?? true,
originalId: $array['originalId'] ?? '',
type: $array['type'] ?? 'legacy',
database: $array['database'] ?? 'legacy'
type: $array['type'] ?? Resource::TYPE_DATABASE_VECTORDB,
database: $array['database']
);
}
}