Skip to content

Commit

Permalink
Merge pull request #9091 from nextcloud/bug/5200/null-null-null
Browse files Browse the repository at this point in the history
fix: add name_hash as nullable
  • Loading branch information
ChristophWurst authored Nov 24, 2023
2 parents 4f955d8 + d8de6d2 commit 5c7e9d4
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion appinfo/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ The rating depends on the installed text processing backend. See [the rating ove
Learn more about the Nextcloud Ethical AI Rating [in our blog](https://nextcloud.com/blog/nextcloud-ethical-ai-rating/).
]]></description>
<version>3.6.0-alpha.2</version>
<version>3.6.0-alpha.3</version>
<licence>agpl</licence>
<author>Christoph Wurst</author>
<author homepage="https://github.com/nextcloud/groupware">Nextcloud Groupware Team</author>
Expand Down
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 5c7e9d4

Please sign in to comment.