getTable('mail_mailboxes'); /** * The migration "Version0161Date20190902103701" created a unique index for account_id and name without * specifying a name. Unfortunately, this resulted in different index names depending on the table * prefix, which means we now have to loop through the indexes to find the correct one. * * The index on account_id and name were supposed to be dropped in "Version3500Date20231115184458", * but this did not work on every setup due to the name mismatch caused by different table prefixes. * * Although it is not recommended to change migrations after release, * we are updating this one with a safeguard to drop any existing index on account_id and name. * * @see \OCA\Mail\Migration\Version0161Date20190902103701::changeSchema * @see \OCA\Mail\Migration\Version3500Date20231115184458::changeSchema */ foreach ($mailboxes->getIndexes() as $index) { if ($index->isUnique() && $index->spansColumns(['account_id', 'name'])) { $mailboxes->dropIndex($index->getName()); } } $mailboxes->modifyColumn( 'name', ['length' => 1024] ); return $schema; } }