Skip to content

Commit 3ffcfb1

Browse files
Merge pull request #47069 from nextcloud/fix/noid/display-message-on-no-migration-attributes
fix(migration-preview): display a message if no attributes set
2 parents 3da69fc + 6ad6fa6 commit 3ffcfb1

2 files changed

Lines changed: 21 additions & 0 deletions

File tree

core/Command/Db/Migrations/PreviewCommand.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,12 @@ public function execute(InputInterface $input, OutputInterface $output): int {
6262
}
6363
$table->render();
6464

65+
$unsupportedApps = $this->metadataManager->getUnsupportedApps($metadata['migrations']);
66+
if (!empty($unsupportedApps)) {
67+
$output->writeln('');
68+
$output->writeln('Those apps are not supporting metadata yet and might initiate migrations on upgrade: <info>' . implode(', ', $unsupportedApps) . '</info>');
69+
}
70+
6571
return 0;
6672
}
6773

@@ -90,6 +96,9 @@ private function displayMigrations(Table $table, string $appId, array $data): vo
9096
/** @var MigrationAttribute[] $attributes */
9197
foreach($data as $migration => $attributes) {
9298
$attributesStr = [];
99+
if (empty($attributes)) {
100+
$attributesStr[] = '<comment>(metadata not set)</comment>';
101+
}
93102
foreach($attributes as $attribute) {
94103
$definition = '<info>' . $attribute->definition() . "</info>";
95104
$definition .= empty($attribute->getDescription()) ? '' : "\n " . $attribute->getDescription();

lib/private/Migration/MetadataManager.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,18 @@ public function getMigrationsAttributesFromReleaseMetadata(
8888
];
8989
}
9090

91+
/**
92+
* returns list of installed apps that does not support migrations metadata (yet)
93+
*
94+
* @param array<array-key, array<array-key, array>> $metadata
95+
*
96+
* @return string[]
97+
* @since 30.0.0
98+
*/
99+
public function getUnsupportedApps(array $metadata): array {
100+
return array_values(array_diff($this->appManager->getInstalledApps(), array_keys($metadata['apps'])));
101+
}
102+
91103
/**
92104
* convert raw data to a list of MigrationAttribute
93105
*

0 commit comments

Comments
 (0)