fix querybuilder instance recuse

...and execute delete query

Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
This commit is contained in:
Arthur Schiwon 2022-10-13 10:29:37 +02:00
parent 61d2937bf4
commit 982534349a
No known key found for this signature in database
GPG key ID: 7424F1874854DF23

View file

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