diff options
author | Anna Larch <anna@nextcloud.com> | 2021-04-08 12:24:37 +0300 |
---|---|---|
committer | Christoph Wurst <christoph@winzerhof-wurst.at> | 2021-04-12 10:37:22 +0300 |
commit | 4f54f3e2a38fab5b71eb74100ffcc5716281ba8f (patch) | |
tree | 72d908983100db069a547c0f31b94a59e05d274c /lib/Migration | |
parent | e09b316df9c19cdb84e4aecdb615909872f23e72 (diff) |
Split migrations for backport
Signed-off-by: Anna Larch <anna@nextcloud.com>
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'lib/Migration')
-rw-r--r-- | lib/Migration/Version1096Date20210407150016.php | 111 | ||||
-rw-r--r-- | lib/Migration/Version1100Date20210406144257.php | 101 | ||||
-rw-r--r-- | lib/Migration/Version1100Date20210409091311.php | 33 |
3 files changed, 144 insertions, 101 deletions
diff --git a/lib/Migration/Version1096Date20210407150016.php b/lib/Migration/Version1096Date20210407150016.php new file mode 100644 index 000000000..b6f0dabf3 --- /dev/null +++ b/lib/Migration/Version1096Date20210407150016.php @@ -0,0 +1,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; + } +} diff --git a/lib/Migration/Version1100Date20210406144257.php b/lib/Migration/Version1100Date20210406144257.php deleted file mode 100644 index 709d436d6..000000000 --- a/lib/Migration/Version1100Date20210406144257.php +++ /dev/null @@ -1,101 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace OCA\Mail\Migration; - -use Closure; -use OCP\DB\ISchemaWrapper; -use OCP\Migration\IOutput; -use OCP\Migration\SimpleMigrationStep; - -class Version1100Date20210406144257 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(); - - $table = $schema->getTable('mail_accounts'); - $table->changeColumn('provisioned', [ - 'notnull' => false, - 'default' => false - ]); - $table->changeColumn('show_subscribed_only', [ - 'notnull' => false, - 'default' => false - ]); - $table->changeColumn('sieve_enabled', [ - 'notnull' => false, - 'default' => false - ]); - - $table = $schema->getTable('mail_classifiers'); - $table->changeColumn('active', [ - 'notnull' => false, - 'default' => false - ]); - - $table = $schema->getTable('mail_mailboxes'); - $table->changeColumn('selectable', [ - 'notnull' => false, - 'default' => false - ]); - $table->changeColumn('sync_in_background', [ - 'notnull' => false, - 'default' => false - ]); - - $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; - } -} diff --git a/lib/Migration/Version1100Date20210409091311.php b/lib/Migration/Version1100Date20210409091311.php new file mode 100644 index 000000000..05e1c8352 --- /dev/null +++ b/lib/Migration/Version1100Date20210409091311.php @@ -0,0 +1,33 @@ +<?php + +declare(strict_types=1); + +namespace OCA\Mail\Migration; + +use Closure; +use OCP\DB\ISchemaWrapper; +use OCP\Migration\IOutput; +use OCP\Migration\SimpleMigrationStep; + +class Version1100Date20210409091311 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_tags')) { + $table = $schema->getTable('mail_tags'); + $table->changeColumn('is_default_tag', [ + 'notnull' => false, + 'default' => false + ]); + } + return $schema; + } +} |