Welcome to mirror list, hosted at ThFree Co, Russian Federation.

Version1100Date20210326103929.php « Migration « lib - github.com/nextcloud/mail.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 6bf0364e22dd10e4306756908f05a0475bc49615 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
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;
	}
}