Skip to content
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Fix migration parameter handling
Signed-off-by: Joas Schilling <[email protected]>
  • Loading branch information
nickvergessen committed Oct 13, 2022
commit 4d98128e9a4c170efb7ae1e5e063df14844964a2
17 changes: 8 additions & 9 deletions core/Migrations/Version25000Date20221007010957.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,23 +51,22 @@ public function __construct(IDBConnection $connection) {
*/
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();
}
}