mirror of
https://github.com/appwrite/appwrite
synced 2026-05-23 17:08:45 +00:00
Fix DB read source
This commit is contained in:
parent
57a46b98ec
commit
1722e9e416
1 changed files with 13 additions and 0 deletions
|
|
@ -18,6 +18,7 @@ use Utopia\Migration\Destination;
|
|||
use Utopia\Migration\Destinations\Appwrite as DestinationAppwrite;
|
||||
use Utopia\Migration\Exception as MigrationException;
|
||||
use Utopia\Migration\Source;
|
||||
use Utopia\Migration\Sources\Appwrite;
|
||||
use Utopia\Migration\Sources\Appwrite as SourceAppwrite;
|
||||
use Utopia\Migration\Sources\CSV;
|
||||
use Utopia\Migration\Sources\Firebase;
|
||||
|
|
@ -113,9 +114,17 @@ class Migrations extends Action
|
|||
protected function processSource(Document $migration): Source
|
||||
{
|
||||
$source = $migration->getAttribute('source');
|
||||
$destination = $migration->getAttribute('destination');
|
||||
$resourceId = $migration->getAttribute('resourceId');
|
||||
$credentials = $migration->getAttribute('credentials');
|
||||
$migrationOptions = $migration->getAttribute('options');
|
||||
$dataSource = Appwrite::SOURCE_API;
|
||||
$database = null;
|
||||
|
||||
if ($source === Appwrite::getName() && $destination === DestinationCSV::getName()) {
|
||||
$dataSource = Appwrite::SOURCE_DATABASE;
|
||||
$database = $this->dbForProject;
|
||||
}
|
||||
|
||||
$migrationSource = match ($source) {
|
||||
Firebase::getName() => new Firebase(
|
||||
|
|
@ -143,6 +152,8 @@ class Migrations extends Action
|
|||
$credentials['projectId'],
|
||||
$credentials['endpoint'] === 'http://localhost/v1' ? 'http://appwrite/v1' : $credentials['endpoint'],
|
||||
$credentials['apiKey'],
|
||||
$dataSource,
|
||||
$database
|
||||
),
|
||||
CSV::getName() => new CSV(
|
||||
$resourceId,
|
||||
|
|
@ -251,7 +262,9 @@ class Migrations extends Action
|
|||
'functions.write',
|
||||
'databases.read',
|
||||
'collections.read',
|
||||
'collections.write',
|
||||
'tables.read',
|
||||
'tables.write',
|
||||
'documents.read',
|
||||
'documents.write',
|
||||
'rows.read',
|
||||
|
|
|
|||
Loading…
Reference in a new issue