diff options
author | dartcafe <github@dartcafe.de> | 2020-10-02 15:34:37 +0300 |
---|---|---|
committer | dartcafe <github@dartcafe.de> | 2020-10-02 15:34:37 +0300 |
commit | 88cce480d507b0a725c78be4ef22211524ba3566 (patch) | |
tree | 434399ff5b9363f6e2c4165b0303afd069b2760e | |
parent | 0b6fb4a6d5727b4ed9ace6c3f4a760abeecca718 (diff) |
fix migration1.6-circles-alpha2
-rw-r--r-- | lib/Migration/Version0106Date20211001092239.php | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/lib/Migration/Version0106Date20211001092239.php b/lib/Migration/Version0106Date20211001092239.php new file mode 100644 index 00000000..41e49e95 --- /dev/null +++ b/lib/Migration/Version0106Date20211001092239.php @@ -0,0 +1,75 @@ +<?php +/** + * @copyright Copyright (c) 2017 René Gieling <github@dartcafe.de> + * + * @author René Gieling <github@dartcafe.de> + * + * @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\Polls\Migration; + +use OCP\DB\ISchemaWrapper; +use OCP\IConfig; +use OCP\IDBConnection; +use OCP\Migration\SimpleMigrationStep; +use OCP\Migration\IOutput; + +/** + * Installation class for the polls app. + * Initial db creation + */ +class Version0106Date20211001092239 extends SimpleMigrationStep { + + /** @var IDBConnection */ + protected $connection; + + /** @var IConfig */ + protected $config; + + /** + * @param IDBConnection $connection + * @param IConfig $config + */ + public function __construct(IDBConnection $connection, IConfig $config) { + $this->connection = $connection; + $this->config = $config; + } + + /** + * @param IOutput $output + * @param \Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` + * @param array $options + * @return null|ISchemaWrapper + * @since 13.0.0 + */ + public function changeSchema(IOutput $output, \Closure $schemaClosure, array $options) { + /** @var ISchemaWrapper $schema */ + $schema = $schemaClosure(); + if ($schema->hasTable('polls_share')) { + $table = $schema->getTable('polls_share'); + if (!$table->hasColumn('display_name')) { + $table->addColumn('display_name', 'string', [ + 'notnull' => true, + 'length' => 64, + ]); + } + } + + return $schema; + } +} |