|
| 1 | +<?php |
| 2 | + |
| 3 | +declare(strict_types=1); |
| 4 | + |
| 5 | +/** |
| 6 | + * Circles - Bring cloud-users closer together. |
| 7 | + * |
| 8 | + * This file is licensed under the Affero General Public License version 3 or |
| 9 | + * later. See the COPYING file. |
| 10 | + * |
| 11 | + * @author Maxence Lange <maxence@artificial-owl.com> |
| 12 | + * @copyright 2019 |
| 13 | + * @license GNU AGPL version 3 or any later version |
| 14 | + * |
| 15 | + * This program is free software: you can redistribute it and/or modify |
| 16 | + * it under the terms of the GNU Affero General Public License as |
| 17 | + * published by the Free Software Foundation, either version 3 of the |
| 18 | + * License, or (at your option) any later version. |
| 19 | + * |
| 20 | + * This program is distributed in the hope that it will be useful, |
| 21 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 22 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 23 | + * GNU Affero General Public License for more details. |
| 24 | + * |
| 25 | + * You should have received a copy of the GNU Affero General Public License |
| 26 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 27 | + * |
| 28 | + */ |
| 29 | + |
| 30 | + |
| 31 | +namespace OCA\Circles\Migration; |
| 32 | + |
| 33 | + |
| 34 | +use Closure; |
| 35 | +use Doctrine\DBAL\Schema\SchemaException; |
| 36 | +use OCP\DB\ISchemaWrapper; |
| 37 | +use OCP\IDBConnection; |
| 38 | +use OCP\Migration\IOutput; |
| 39 | +use OCP\Migration\SimpleMigrationStep; |
| 40 | + |
| 41 | + |
| 42 | +/** |
| 43 | + * Class Version0019Date20211007115911 |
| 44 | + * |
| 45 | + * @package OCA\Circles\Migration |
| 46 | + */ |
| 47 | +class Version0019Date20211007115911 extends SimpleMigrationStep { |
| 48 | + |
| 49 | + |
| 50 | + /** @var IDBConnection */ |
| 51 | + private $connection; |
| 52 | + |
| 53 | + |
| 54 | + /** |
| 55 | + * @param IDBConnection $connection |
| 56 | + */ |
| 57 | + public function __construct(IDBConnection $connection) { |
| 58 | + $this->connection = $connection; |
| 59 | + } |
| 60 | + |
| 61 | + |
| 62 | + /** |
| 63 | + * @param IOutput $output |
| 64 | + * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` |
| 65 | + * @param array $options |
| 66 | + * |
| 67 | + * @return null|ISchemaWrapper |
| 68 | + * @throws SchemaException |
| 69 | + */ |
| 70 | + public function changeSchema(IOutput $output, Closure $schemaClosure, array $options) { |
| 71 | + /** @var ISchemaWrapper $schema */ |
| 72 | + $schema = $schemaClosure(); |
| 73 | + |
| 74 | + $table = $schema->getTable('circle_gsshares'); |
| 75 | + $table->changeColumn( |
| 76 | + 'owner', [ |
| 77 | + 'length' => 127 |
| 78 | + ] |
| 79 | + ); |
| 80 | + |
| 81 | + |
| 82 | + return $schema; |
| 83 | + } |
| 84 | + |
| 85 | +} |
| 86 | + |
0 commit comments