mirror of
https://github.com/appwrite/appwrite
synced 2026-05-20 23:48:23 +00:00
add: expose source report for cloud.
This commit is contained in:
parent
bf9deb09f5
commit
d137b41c0b
1 changed files with 24 additions and 1 deletions
|
|
@ -34,6 +34,13 @@ class Migrations extends Action
|
|||
|
||||
protected Document $project;
|
||||
|
||||
/**
|
||||
* Accessed on cloud for telemetry.
|
||||
*
|
||||
* @type array<string, int>
|
||||
*/
|
||||
private array $sourceReport = [];
|
||||
|
||||
/**
|
||||
* @var callable
|
||||
*/
|
||||
|
|
@ -101,7 +108,7 @@ class Migrations extends Action
|
|||
$source = $migration->getAttribute('source');
|
||||
$credentials = $migration->getAttribute('credentials');
|
||||
|
||||
return match ($source) {
|
||||
$migrationSource = match ($source) {
|
||||
Firebase::getName() => new Firebase(
|
||||
json_decode($credentials['serviceAccount'], true),
|
||||
),
|
||||
|
|
@ -130,6 +137,10 @@ class Migrations extends Action
|
|||
),
|
||||
default => throw new \Exception('Invalid source type'),
|
||||
};
|
||||
|
||||
$this->sourceReport = $migrationSource->report();
|
||||
|
||||
return $migrationSource;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -381,4 +392,16 @@ class Migrations extends Action
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a report of resources in the source.
|
||||
*
|
||||
* Should be called after `processSource()` to ensure the data is populated.
|
||||
*
|
||||
* @return array<string, int> Resource type mapped to their counts.
|
||||
*/
|
||||
protected function getSourceReport(): array
|
||||
{
|
||||
return $this->sourceReport;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue