diff options
Diffstat (limited to 'core/Migrations/Version25000Date20220602190540.php')
-rw-r--r-- | core/Migrations/Version25000Date20220602190540.php | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/core/Migrations/Version25000Date20220602190540.php b/core/Migrations/Version25000Date20220602190540.php new file mode 100644 index 00000000000..999a0c50e60 --- /dev/null +++ b/core/Migrations/Version25000Date20220602190540.php @@ -0,0 +1,39 @@ +<?php + +declare(strict_types=1); + +/** + * SPDX-FileCopyrightText: 2022 Nextcloud GmbH and Nextcloud contributors + * SPDX-License-Identifier: AGPL-3.0-or-later + */ + +namespace OC\Core\Migrations; + +use Closure; +use OCP\DB\ISchemaWrapper; +use OCP\DB\Types; +use OCP\Migration\IOutput; +use OCP\Migration\SimpleMigrationStep; + +class Version25000Date20220602190540 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(); + + $comments = $schema->getTable('comments'); + if (!$comments->hasColumn('expire_date')) { + $comments->addColumn('expire_date', Types::DATETIME, [ + 'notnull' => false, + ]); + $comments->addIndex(['expire_date'], 'expire_date'); + return $schema; + } + return null; + } +} |