Skip to content

Commit

Permalink
Merge pull request #9092 from nextcloud/bug/5200/null-null-null-stabl…
Browse files Browse the repository at this point in the history
…e3.5

fix: add name_hash as nullable
  • Loading branch information
ChristophWurst authored Nov 24, 2023
2 parents 6df70e1 + 4d713d3 commit 5eeaa1f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/Migration/Version3500Date20231115182612.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public function changeSchema(IOutput $output, Closure $schemaClosure, array $opt

$mailboxesTable = $schema->getTable('mail_mailboxes');
if (!$mailboxesTable->hasColumn('name_hash')) {
$mailboxesTable->addColumn('name_hash', Types::STRING);
$mailboxesTable->addColumn('name_hash', Types::STRING, ['notnull' => false]);
}

return $schema;
Expand Down Expand Up @@ -83,7 +83,7 @@ public function postSchemaChange(IOutput $output, Closure $schemaClosure, array
$qb = $this->connection->getQueryBuilder();
$qb->select(['id', 'name'])
->from('mail_mailboxes')
->where($qb->expr()->emptyString('name_hash'));
->where($qb->expr()->isNull('name_hash'));
$mailboxes = $qb->executeQuery();

$updateQb = $this->connection->getQueryBuilder();
Expand Down
5 changes: 5 additions & 0 deletions lib/Migration/Version3500Date20231115184458.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,11 @@ public function changeSchema(IOutput $output, Closure $schemaClosure, array $opt
$mailboxesTable->addUniqueIndex(['account_id', 'name_hash'], $indexNew);
}

$nameHashColumn = $mailboxesTable->getColumn('name_hash');
if (!$nameHashColumn->getNotnull()) {
$nameHashColumn->setNotnull(true);
}

return $schema;
}
}

0 comments on commit 5eeaa1f

Please sign in to comment.