From 368334c8356fa0b5d8be0983e49e88000816e81c Mon Sep 17 00:00:00 2001 From: Daniel Kesselberg Date: Mon, 1 Jul 2024 11:44:40 +0200 Subject: [PATCH] fixup! fix: make sure inbound_password uses null as default Signed-off-by: Daniel Kesselberg --- lib/Migration/Version3800Date20240628163133.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/lib/Migration/Version3800Date20240628163133.php b/lib/Migration/Version3800Date20240628163133.php index bac31dfb90..dda7d691e2 100644 --- a/lib/Migration/Version3800Date20240628163133.php +++ b/lib/Migration/Version3800Date20240628163133.php @@ -11,11 +11,17 @@ use Closure; use OCP\DB\ISchemaWrapper; +use OCP\DB\QueryBuilder\IQueryBuilder; +use OCP\IDBConnection; use OCP\Migration\IOutput; use OCP\Migration\SimpleMigrationStep; class Version3800Date20240628163133 extends SimpleMigrationStep { + public function __construct( + private IDBConnection $connection + ) { + } public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper { /** @var ISchemaWrapper $schema */ @@ -39,4 +45,11 @@ public function changeSchema(IOutput $output, Closure $schemaClosure, array $opt return null; } + public function postSchemaChange(IOutput $output, Closure $schemaClosure, array $options) { + $qb = $this->connection->getQueryBuilder(); + $qb->update('mail_accounts') + ->set('inbound_password', $qb->createNamedParameter(null, IQueryBuilder::PARAM_NULL)) + ->where($qb->expr()->emptyString('inbound_password')); + $qb->executeStatement(); + } }