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

Version1096Date20210407150016.php « Migration « lib - github.com/nextcloud/mail.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: b6f0dabf35589312eb2e807c2d67e1b6a140db05 (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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
<?php

declare(strict_types=1);

namespace OCA\Mail\Migration;

use Closure;
use OCP\DB\ISchemaWrapper;
use OCP\Migration\IOutput;
use OCP\Migration\SimpleMigrationStep;

class Version1096Date20210407150016 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 {
		/** @var ISchemaWrapper $schema */
		$schema = $schemaClosure();

		if ($schema->hasTable('mail_accounts')) {
			$table = $schema->getTable('mail_accounts');
			$table->changeColumn('provisioned', [
				'notnull' => false,
				'default' => false
			]);
			$table->changeColumn('show_subscribed_only', [
				'notnull' => false,
				'default' => false
			]);
			$table = $schema->getTable('mail_accounts');
			$table->changeColumn('sieve_enabled', [
				'notnull' => false,
				'default' => false
			]);
		}

		if ($schema->hasTable('mail_classifiers')) {
			$table = $schema->getTable('mail_classifiers');
			$table->changeColumn('active', [
				'notnull' => false,
				'default' => false
			]);
		}

		if ($schema->hasTable('mail_mailboxes')) {
			$table = $schema->getTable('mail_mailboxes');
			$table->changeColumn('selectable', [
				'notnull' => false,
				'default' => false
			]);
			$table->changeColumn('sync_in_background', [
				'notnull' => false,
				'default' => false
			]);
		}

		if ($schema->hasTable('mail_messages')) {
			$table = $schema->getTable('mail_messages');
			$table->changeColumn('flag_answered', [
				'notnull' => false,
				'default' => false
			]);
			$table->changeColumn('flag_deleted', [
				'notnull' => false,
				'default' => false
			]);
			$table->changeColumn('flag_draft', [
				'notnull' => false,
				'default' => false
			]);
			$table->changeColumn('flag_flagged', [
				'notnull' => false,
				'default' => false
			]);
			$table->changeColumn('flag_seen', [
				'notnull' => false,
				'default' => false
			]);
			$table->changeColumn('flag_forwarded', [
				'notnull' => false,
				'default' => false
			]);
			$table->changeColumn('flag_junk', [
				'notnull' => false,
				'default' => false
			]);
			$table->changeColumn('flag_notjunk', [
				'notnull' => false,
				'default' => false
			]);
			$table->changeColumn('flag_important', [
				'notnull' => false,
				'default' => false
			]);
			$table->changeColumn('flag_mdnsent', [
				'notnull' => false,
				'default' => false
			]);
			$table->changeColumn('structure_analyzed', [
				'notnull' => false,
				'default' => false
			]);
		}

		return $schema;
	}
}