diff options
author | Julius Härtl <jus@bitgrid.net> | 2021-01-05 11:32:33 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-05 11:32:33 +0300 |
commit | 39c67d9868d15fa42031b8bafebc6bc05eac867e (patch) | |
tree | ca221e2eae3d05ff547fc539a2c7f42eadbc74c4 /apps/files_sharing/lib | |
parent | 364b29b1e96bd3328d1e2a4d96d167100f6897a8 (diff) | |
parent | 6c0de14b4c49430896c53a025ae912ca73cb0f60 (diff) |
Merge pull request #24829 from nextcloud/bugfix/24813/add-missing-migrations
Diffstat (limited to 'apps/files_sharing/lib')
-rw-r--r-- | apps/files_sharing/lib/Migration/Version11300Date20201120141438.php | 15 | ||||
-rw-r--r-- | apps/files_sharing/lib/Migration/Version21000Date20201223143245.php | 70 |
2 files changed, 85 insertions, 0 deletions
diff --git a/apps/files_sharing/lib/Migration/Version11300Date20201120141438.php b/apps/files_sharing/lib/Migration/Version11300Date20201120141438.php index 687e212e9f6..8094feaef50 100644 --- a/apps/files_sharing/lib/Migration/Version11300Date20201120141438.php +++ b/apps/files_sharing/lib/Migration/Version11300Date20201120141438.php @@ -116,6 +116,21 @@ class Version11300Date20201120141438 extends SimpleMigrationStep { $remoteIdColumn->setOptions(['length' => 255]); $remoteIdColumn->setDefault(''); } + if (!$table->hasColumn('parent')) { + $table->addColumn('parent', Types::BIGINT, [ + 'notnull' => false, + 'default' => -1, + ]); + } + if (!$table->hasColumn('share_type')) { + $table->addColumn('share_type', Types::INTEGER, [ + 'notnull' => false, + 'length' => 4, + ]); + } + if ($table->hasColumn('lastscan')) { + $table->dropColumn('lastscan'); + } } return $schema; diff --git a/apps/files_sharing/lib/Migration/Version21000Date20201223143245.php b/apps/files_sharing/lib/Migration/Version21000Date20201223143245.php new file mode 100644 index 00000000000..5dfdb09f1ec --- /dev/null +++ b/apps/files_sharing/lib/Migration/Version21000Date20201223143245.php @@ -0,0 +1,70 @@ +<?php + +declare(strict_types=1); + +/** + * @copyright Copyright (c) 2020 Vincent Petry <vincent@nextcloud.com> + * + * @author Vincent Petry <vincent@nextcloud.com> + * + * @license GNU AGPL version 3 or any later version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ + + +namespace OCA\Files_Sharing\Migration; + +use Closure; +use Doctrine\DBAL\Types\Types; +use OCP\DB\ISchemaWrapper; +use OCP\Migration\IOutput; +use OCP\Migration\SimpleMigrationStep; + +class Version21000Date20201223143245 extends SimpleMigrationStep { + public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper { + /** @var ISchemaWrapper $schema */ + $schema = $schemaClosure(); + + if ($schema->hasTable('share_external')) { + $table = $schema->getTable('share_external'); + $changed = false; + if (!$table->hasColumn('parent')) { + $table->addColumn('parent', Types::BIGINT, [ + 'notnull' => false, + 'default' => -1, + ]); + $changed = true; + } + if (!$table->hasColumn('share_type')) { + $table->addColumn('share_type', Types::INTEGER, [ + 'notnull' => false, + 'length' => 4, + ]); + $changed = true; + } + if ($table->hasColumn('lastscan')) { + $table->dropColumn('lastscan'); + $changed = true; + } + + if ($changed) { + return $schema; + } + } + + return null; + } +} |