0
0
Fork 0
mirror of https://github.com/nextcloud/server.git synced 2025-03-16 09:14:07 +00:00

Fix migration parameter handling

Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
Joas Schilling 2022-10-13 10:36:05 +02:00
parent b4f6329a83
commit 4d98128e9a
No known key found for this signature in database
GPG key ID: 74434EFE0D2E2205

View file

@ -51,23 +51,22 @@ class Version25000Date20221007010957 extends SimpleMigrationStep {
*/
public function postSchemaChange(IOutput $output, Closure $schemaClosure, array $options): void {
$cleanUpQuery = $this->connection->getQueryBuilder();
$orExpr = $cleanUpQuery->expr()->orX(
$cleanUpQuery->expr()->eq('configkey', $cleanUpQuery->createNamedParameter('background')),
$cleanUpQuery->expr()->eq('configkey', $cleanUpQuery->createNamedParameter('backgroundVersion')),
);
$cleanUpQuery->delete('preferences')
->where($cleanUpQuery->expr()->eq('appid', $cleanUpQuery->createNamedParameter('theming')))
->andWhere($orExpr);
->andWhere($cleanUpQuery->expr()->orX(
$cleanUpQuery->expr()->eq('configkey', $cleanUpQuery->createNamedParameter('background')),
$cleanUpQuery->expr()->eq('configkey', $cleanUpQuery->createNamedParameter('backgroundVersion')),
));
$cleanUpQuery->executeStatement();
$updateQuery = $this->connection->getQueryBuilder();
$updateQuery->update('preferences')
->set('appid', $updateQuery->createNamedParameter('theming'))
->where($updateQuery->expr()->eq('appid', $updateQuery->createNamedParameter('dashboard')))
->andWhere($orExpr);
->andWhere($updateQuery->expr()->orX(
$updateQuery->expr()->eq('configkey', $updateQuery->createNamedParameter('background')),
$updateQuery->expr()->eq('configkey', $updateQuery->createNamedParameter('backgroundVersion')),
));
$updateQuery->executeStatement();
}
}