diff options
author | Anna Larch <anna@nextcloud.com> | 2021-04-08 12:07:24 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-08 12:07:24 +0300 |
commit | 68cbd65b1700412572434420086b1f1252bc1ec8 (patch) | |
tree | 20cfa3cb5c3f51e5f54261d13b63a6417ef55a78 /lib/Migration | |
parent | dbcdc402b65021d369d1a890d261cda2d8578eab (diff) | |
parent | 49138926a8d87e3228edee376e0d919d81f407ac (diff) |
Merge pull request #4840 from nextcloud/enhancement/rework-duplicate-entries-for-tag-message
Rework duplicate entry handling for tags
Diffstat (limited to 'lib/Migration')
-rw-r--r-- | lib/Migration/Version1100Date20210304143008.php | 7 | ||||
-rw-r--r-- | lib/Migration/Version1100Date20210326103929.php | 37 |
2 files changed, 37 insertions, 7 deletions
diff --git a/lib/Migration/Version1100Date20210304143008.php b/lib/Migration/Version1100Date20210304143008.php index 70ae39e59..0cadb4669 100644 --- a/lib/Migration/Version1100Date20210304143008.php +++ b/lib/Migration/Version1100Date20210304143008.php @@ -78,13 +78,6 @@ class Version1100Date20210304143008 extends SimpleMigrationStep { 'length' => 4, ]); $tagsMessageTable->setPrimaryKey(['id']); - $tagsMessageTable->addUniqueIndex( - [ - 'imap_message_id', - 'tag_id', - ], - 'mail_msg_tag_id_idx' - ); } return $schema; } diff --git a/lib/Migration/Version1100Date20210326103929.php b/lib/Migration/Version1100Date20210326103929.php new file mode 100644 index 000000000..6bf0364e2 --- /dev/null +++ b/lib/Migration/Version1100Date20210326103929.php @@ -0,0 +1,37 @@ +<?php + +declare(strict_types=1); + +namespace OCA\Mail\Migration; + +use Closure; +use OCP\DB\ISchemaWrapper; +use OCP\Migration\IOutput; +use OCP\Migration\SimpleMigrationStep; + +/** + * @link https://github.com/nextcloud/mail/issues/4833 + */ +class Version1100Date20210326103929 extends SimpleMigrationStep { + + /** + * @param IOutput $output + * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` + * @param array $options + * @return null|ISchemaWrapper + */ + public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper { + $schema = $schemaClosure(); + + if ($schema->hasTable('mail_message_tags')) { + $table = $schema->getTable('mail_message_tags'); + if ($table->hasIndex('mail_msg_tag_id_idx')) { + $table->dropIndex('mail_msg_tag_id_idx'); + } + if (!$table->hasIndex('mail_msg_imap_id_idx')) { + $table->addIndex(['imap_message_id'], 'mail_msg_imap_id_idx', [], ['lengths' => [128]]); + } + } + return $schema; + } +} |