diff options
author | Georg Ehrke <developer@georgehrke.com> | 2018-11-05 12:08:41 +0100 |
---|---|---|
committer | Morris Jobke <hey@morrisjobke.de> | 2018-11-13 16:32:47 +0100 |
commit | 071301bfb9445e0df61f62cb48c6b0d2956de27f (patch) | |
tree | 731556853175c5b40c827d0aed6c7fef81ebd07b /apps/dav/lib/Migration | |
parent | 3117e996be466c7d4a061d41639562c70f2fc27f (diff) | |
download | nextcloud-server-071301bfb9445e0df61f62cb48c6b0d2956de27f.tar.gz nextcloud-server-071301bfb9445e0df61f62cb48c6b0d2956de27f.zip |
Fix Calendarsubscriptions source column change on Oracle
Signed-off-by: Georg Ehrke <developer@georgehrke.com>
Diffstat (limited to 'apps/dav/lib/Migration')
-rw-r--r-- | apps/dav/lib/Migration/Version1008Date20181105104826.php | 80 | ||||
-rw-r--r-- | apps/dav/lib/Migration/Version1008Date20181105104833.php (renamed from apps/dav/lib/Migration/Version1007Date20181007225117.php) | 11 | ||||
-rw-r--r-- | apps/dav/lib/Migration/Version1008Date20181105110300.php | 79 | ||||
-rw-r--r-- | apps/dav/lib/Migration/Version1008Date20181105112049.php | 49 |
4 files changed, 211 insertions, 8 deletions
diff --git a/apps/dav/lib/Migration/Version1008Date20181105104826.php b/apps/dav/lib/Migration/Version1008Date20181105104826.php new file mode 100644 index 00000000000..b5b0545102d --- /dev/null +++ b/apps/dav/lib/Migration/Version1008Date20181105104826.php @@ -0,0 +1,80 @@ +<?php +/** + * @copyright Copyright (c) 2018 Georg Ehrke + * + * @author Georg Ehrke <oc.list@georgehrke.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/>. + * + */ + +declare(strict_types=1); + +namespace OCA\DAV\Migration; + + +use Closure; +use Doctrine\DBAL\Types\Type; +use OCP\DB\ISchemaWrapper; +use OCP\IDBConnection; +use OCP\Migration\SimpleMigrationStep; +use OCP\Migration\IOutput; + +class Version1008Date20181105104826 extends SimpleMigrationStep { + + /** @var IDBConnection */ + private $connection; + + /** + * Version1008Date20181105104826 constructor. + * + * @param IDBConnection $connection + */ + public function __construct(IDBConnection $connection) { + $this->connection = $connection; + } + + /** + * @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) { + /** @var ISchemaWrapper $schema */ + $schema = $schemaClosure(); + $table = $schema->getTable('calendarsubscriptions'); + + $table->addColumn('source_copy', Type::TEXT, [ + 'notnull' => false, + 'length' => null, + ]); + + return $schema; + } + + /** + * @param IOutput $output + * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` + * @param array $options + */ + public function postSchemaChange(IOutput $output, Closure $schemaClosure, array $options) { + $qb = $this->connection->getQueryBuilder(); + $qb->update('calendarsubscriptions') + ->set('source_copy', 'source') + ->execute(); + } +} diff --git a/apps/dav/lib/Migration/Version1007Date20181007225117.php b/apps/dav/lib/Migration/Version1008Date20181105104833.php index 400042f486d..9167fa0463b 100644 --- a/apps/dav/lib/Migration/Version1007Date20181007225117.php +++ b/apps/dav/lib/Migration/Version1008Date20181105104833.php @@ -20,18 +20,17 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * */ + declare(strict_types=1); namespace OCA\DAV\Migration; use Closure; - -use Doctrine\DBAL\Types\Type; use OCP\DB\ISchemaWrapper; use OCP\Migration\SimpleMigrationStep; use OCP\Migration\IOutput; -class Version1007Date20181007225117 extends SimpleMigrationStep { +class Version1008Date20181105104833 extends SimpleMigrationStep { /** * @param IOutput $output @@ -42,12 +41,8 @@ class Version1007Date20181007225117 extends SimpleMigrationStep { public function changeSchema(IOutput $output, Closure $schemaClosure, array $options) { /** @var ISchemaWrapper $schema */ $schema = $schemaClosure(); - $table = $schema->getTable('calendarsubscriptions'); - $column = $table->getColumn('source'); - - $column->setType(Type::getType(Type::TEXT)); - $column->setLength(null); + $table->dropColumn('source'); return $schema; } diff --git a/apps/dav/lib/Migration/Version1008Date20181105110300.php b/apps/dav/lib/Migration/Version1008Date20181105110300.php new file mode 100644 index 00000000000..db5c0afbd38 --- /dev/null +++ b/apps/dav/lib/Migration/Version1008Date20181105110300.php @@ -0,0 +1,79 @@ +<?php +/** + * @copyright Copyright (c) 2018 Georg Ehrke + * + * @author Georg Ehrke <oc.list@georgehrke.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/>. + * + */ + +declare(strict_types=1); + +namespace OCA\DAV\Migration; + +use Closure; +use Doctrine\DBAL\Types\Type; +use OCP\DB\ISchemaWrapper; +use OCP\IDBConnection; +use OCP\Migration\SimpleMigrationStep; +use OCP\Migration\IOutput; + +class Version1008Date20181105110300 extends SimpleMigrationStep { + + /** @var IDBConnection */ + private $connection; + + /** + * Version1008Date20181105110300 constructor. + * + * @param IDBConnection $connection + */ + public function __construct(IDBConnection $connection) { + $this->connection = $connection; + } + + /** + * @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) { + /** @var ISchemaWrapper $schema */ + $schema = $schemaClosure(); + $table = $schema->getTable('calendarsubscriptions'); + $table->addColumn('source', Type::TEXT, [ + 'notnull' => false, + 'length' => null, + ]); + + return $schema; + } + + /** + * @param IOutput $output + * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` + * @param array $options + */ + public function postSchemaChange(IOutput $output, Closure $schemaClosure, array $options) { + $qb = $this->connection->getQueryBuilder(); + $qb->update('calendarsubscriptions') + ->set('source', 'source_copy') + ->execute(); + } + +} diff --git a/apps/dav/lib/Migration/Version1008Date20181105112049.php b/apps/dav/lib/Migration/Version1008Date20181105112049.php new file mode 100644 index 00000000000..9fe2903603b --- /dev/null +++ b/apps/dav/lib/Migration/Version1008Date20181105112049.php @@ -0,0 +1,49 @@ +<?php +/** + * @copyright Copyright (c) 2018 Georg Ehrke + * + * @author Georg Ehrke <oc.list@georgehrke.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/>. + * + */ + +declare(strict_types=1); + +namespace OCA\DAV\Migration; + +use Closure; +use OCP\DB\ISchemaWrapper; +use OCP\Migration\SimpleMigrationStep; +use OCP\Migration\IOutput; + +class Version1008Date20181105112049 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) { + /** @var ISchemaWrapper $schema */ + $schema = $schemaClosure(); + $table = $schema->getTable('calendarsubscriptions'); + $table->dropColumn('source_copy'); + + return $schema; + } +} |