diff options
author | Joas Schilling <coding@schilljs.com> | 2019-06-27 21:15:39 +0300 |
---|---|---|
committer | Daniel Calviño Sánchez <danxuliu@gmail.com> | 2019-08-28 11:26:02 +0300 |
commit | 12952b93c93ba5eb2974b400676783bd96443345 (patch) | |
tree | fca76a86fcccee7fc9935db37b75842539cb0cf4 /lib | |
parent | 3ee86747256355cd26de5f193ad37780f1dad0f2 (diff) |
Add a lobby state column to the room table
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Migration/Version6099Date20190627172429.php | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/lib/Migration/Version6099Date20190627172429.php b/lib/Migration/Version6099Date20190627172429.php new file mode 100644 index 000000000..5c50244cc --- /dev/null +++ b/lib/Migration/Version6099Date20190627172429.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 Version6099Date20190627172429 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('lobby_state')) { + $table->addColumn('lobby_state', Type::INTEGER, [ + 'notnull' => true, + 'length' => 6, + 'default' => 0, + ]); + } + } + + return $schema; + } +} |