Преглед на файлове

Fix migration parameter handling

Signed-off-by: Joas Schilling <coding@schilljs.com>
tags/v26.0.0beta1
Joas Schilling преди 1 година
родител
ревизия
4d98128e9a
No account linked to committer's email address
променени са 1 файла, в които са добавени 8 реда и са изтрити 9 реда
  1. 8
    9
      core/Migrations/Version25000Date20221007010957.php

+ 8
- 9
core/Migrations/Version25000Date20221007010957.php Целия файл

*/ */
public function postSchemaChange(IOutput $output, Closure $schemaClosure, array $options): void { public function postSchemaChange(IOutput $output, Closure $schemaClosure, array $options): void {
$cleanUpQuery = $this->connection->getQueryBuilder(); $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') $cleanUpQuery->delete('preferences')
->where($cleanUpQuery->expr()->eq('appid', $cleanUpQuery->createNamedParameter('theming'))) ->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(); $cleanUpQuery->executeStatement();


$updateQuery = $this->connection->getQueryBuilder(); $updateQuery = $this->connection->getQueryBuilder();
$updateQuery->update('preferences') $updateQuery->update('preferences')
->set('appid', $updateQuery->createNamedParameter('theming')) ->set('appid', $updateQuery->createNamedParameter('theming'))
->where($updateQuery->expr()->eq('appid', $updateQuery->createNamedParameter('dashboard'))) ->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(); $updateQuery->executeStatement();
} }
} }

Loading…
Отказ
Запис