diff options
author | Joas Schilling <coding@schilljs.com> | 2019-03-19 18:00:21 +0300 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2019-03-25 17:17:19 +0300 |
commit | f1667ac2f77cc56d8e5e69eac0e4f28fd2c5187e (patch) | |
tree | 6e5438b0830994a874484285e296d047d3122f9d /lib/Migration | |
parent | 23f4c2916607c2eb2fdd5ae38566b4b279c9e2ca (diff) |
Introduce a Read-Only state for conversations
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib/Migration')
-rw-r--r-- | lib/Migration/Version5099Date20190319134820.php | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/lib/Migration/Version5099Date20190319134820.php b/lib/Migration/Version5099Date20190319134820.php new file mode 100644 index 000000000..94428dcf5 --- /dev/null +++ b/lib/Migration/Version5099Date20190319134820.php @@ -0,0 +1,58 @@ +<?php +declare(strict_types=1); +/** + * @copyright Copyright (c) 2019, Joas Schilling <coding@schilljs.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\Spreed\Migration; + +use Closure; +use Doctrine\DBAL\Types\Type; +use OCP\DB\ISchemaWrapper; +use OCP\Migration\SimpleMigrationStep; +use OCP\Migration\IOutput; + +class Version5099Date20190319134820 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(); + + if ($schema->hasTable('talk_rooms')) { + $table = $schema->getTable('talk_rooms'); + + if (!$table->hasColumn('read_only')) { + $table->addColumn('read_only', Type::INTEGER, [ + 'notnull' => true, + 'length' => 6, + 'default' => 0, + ]); + } + } + + return $schema; + } + +} |