Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 3 additions & 7 deletions lib/Migration/Version1140Date20220628174152.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,24 +61,20 @@ public function preSchemaChange(IOutput $output, Closure $schemaClosure, array $
$alterQuery = 'ALTER TABLE `%s` MODIFY `%s` longtext null;';

$accountsTable = $schema->getTable('mail_accounts');
$accountsSignatureColumn = $accountsTable->getColumn('signature');

$this->connection->executeStatement(
sprintf($alterQuery, $accountsTable->getName(), $accountsSignatureColumn->getName())
sprintf($alterQuery, $accountsTable->getName(), 'signature')
);

$aliasesTable = $schema->getTable('mail_aliases');
$aliasesSignatureColumn = $accountsTable->getColumn('signature');

$this->connection->executeStatement(
sprintf($alterQuery, $aliasesTable->getName(), $aliasesSignatureColumn->getName())
sprintf($alterQuery, $aliasesTable->getName(), 'signature')
);

unset(
$accountsTable,
$accountsSignatureColumn,
$aliasesTable,
$aliasesSignatureColumn
$aliasesTable
Comment on lines -64 to +77

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here getName return a non-empty-string

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The issue is that IColumn::getName does not exist. It works because of __call but Psalm won't like it.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

);
}
}
Expand Down
2 changes: 1 addition & 1 deletion lib/Migration/Version2300Date20230120085320.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public function changeSchema(IOutput $output, Closure $schemaClosure, array $opt
$schema = $schemaClosure();

$table = $schema->getTable('mail_smime_certificates');
if (!$table->hasPrimaryKey()) {
if ($table->getPrimaryKey() === null) {
$table->setPrimaryKey(['id'], 'mail_smime_certs_id_idx');
}

Expand Down
2 changes: 1 addition & 1 deletion lib/Migration/Version5007Date20251024153423.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public function changeSchema(IOutput $output, Closure $schemaClosure, array $opt
if (!$accountsTable->hasColumn('classification_enabled')) {
$accountsTable->addColumn('classification_enabled', Types::BOOLEAN, [
'default' => true,
'notNull' => false,
'notnull' => false,
]);
}
return $schema;
Expand Down
13 changes: 8 additions & 5 deletions lib/Migration/Version5007Date20260108124422.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
use OCP\DB\Exception;
use OCP\DB\ISchemaWrapper;
use OCP\DB\QueryBuilder\IQueryBuilder;
use OCP\DB\Schema\ITable;
use OCP\IDBConnection;
use OCP\Migration\Attributes\ModifyColumn;
use OCP\Migration\IOutput;
Expand Down Expand Up @@ -82,15 +83,17 @@ private function removeInconsistentMailboxEntries(string $mailboxType): void {
}

/**
* @param Table $accountsTable
* @param Table $mailboxesTable
* @param Table|ITable $accountsTable
* @param Table|ITable $mailboxesTable
* @param string $mailboxType
* @return void
*/
private function addMailboxKey(Table $accountsTable, Table $mailboxesTable, string $mailboxType): void {
private function addMailboxKey(Table|ITable $accountsTable, Table|ITable $mailboxesTable, string $mailboxType): void {
/** @var non-empty-lowercase-string $column */
$column = $mailboxType . '_mailbox_id';
$accountsTable->addForeignKeyConstraint(
$mailboxesTable,
["{$mailboxType}_mailbox_id"],
$mailboxesTable->getName(),
[$column],
['id'],
[
'onDelete' => 'SET NULL',
Expand Down
2 changes: 2 additions & 0 deletions psalm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
<referencedClass name="Doctrine\DBAL\Platforms\PostgreSQL94Platform" />
<referencedClass name="Doctrine\DBAL\Platforms\SqlitePlatform" />
<referencedClass name="Doctrine\DBAL\Schema\Table" />
<referencedClass name="OCP\DB\Schema\ITable" />
<referencedClass name="Doctrine\DBAL\Types\Type" />
<referencedClass name="Doctrine\DBAL\Types\Types" />
<referencedClass name="IPLib\Factory" />
Expand Down Expand Up @@ -67,6 +68,7 @@
<referencedClass name="Doctrine\DBAL\Schema\Schema" />
<referencedClass name="Doctrine\DBAL\Schema\SchemaException" />
<referencedClass name="Doctrine\DBAL\Schema\Table" />
<referencedClass name="OCP\DB\Schema\ITable" />
<referencedClass name="OC\Security\CSP\ContentSecurityPolicyNonceManager" />
<referencedClass name="Symfony\Component\Console\Output\OutputInterface" />
</errorLevel>
Expand Down
Loading