diff options
author | Vitor Mattos <vitor@php.rio> | 2022-12-07 22:45:57 -0300 |
---|---|---|
committer | Vitor Mattos <vitor@php.rio> | 2022-12-09 17:02:08 -0300 |
commit | db88acf9beb04ab6bf1b7d423bcad0c5ad21c542 (patch) | |
tree | 37f1ed6fe23081b7132d51f03e1fab4431dac33f /lib/Migration | |
parent | edb7df03562c93fdfe65fe66b921498fb1b59968 (diff) |
Toggle call recording status
Signed-off-by: Vitor Mattos <vitor@php.rio>
Diffstat (limited to 'lib/Migration')
-rw-r--r-- | lib/Migration/Version16000Date20221208013745.php | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/lib/Migration/Version16000Date20221208013745.php b/lib/Migration/Version16000Date20221208013745.php new file mode 100644 index 000000000..45a9ccfc4 --- /dev/null +++ b/lib/Migration/Version16000Date20221208013745.php @@ -0,0 +1,55 @@ +<?php + +declare(strict_types=1); + +/** + * @copyright Copyright (c) 2022 Vitor Mattos <vitor@php.rio> + * + * @author Vitor Mattos <vitor@php.rio> + * + * @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\Talk\Migration; + +use Closure; +use OCP\DB\ISchemaWrapper; +use OCP\DB\Types; +use OCP\Migration\IOutput; +use OCP\Migration\SimpleMigrationStep; + +class Version16000Date20221208013745 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): ?ISchemaWrapper { + /** @var ISchemaWrapper $schema */ + $schema = $schemaClosure(); + + $table = $schema->getTable('talk_rooms'); + if (!$table->hasColumn('call_recording')) { + $table->addColumn('call_recording', Types::INTEGER, [ + 'default' => 0, + ]); + return $schema; + } + return null; + } +} |