From 8f3e7375eadc4c169174eeed2b887ab856a80d49 Mon Sep 17 00:00:00 2001 From: Gary Kim Date: Thu, 10 Jun 2021 23:35:54 -0400 Subject: [PATCH] Create database for federated access credentials Signed-off-by: Gary Kim --- .../Version12000Date20210610232111.php | 67 +++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 lib/Migration/Version12000Date20210610232111.php diff --git a/lib/Migration/Version12000Date20210610232111.php b/lib/Migration/Version12000Date20210610232111.php new file mode 100644 index 00000000000..01ddb4a759f --- /dev/null +++ b/lib/Migration/Version12000Date20210610232111.php @@ -0,0 +1,67 @@ + + * + * @author Gary Kim + * + * @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 . + * + */ + +namespace OCA\Talk\Migration; + +use Closure; +use Doctrine\DBAL\Types\Types; +use OCP\DB\ISchemaWrapper; +use OCP\Migration\IOutput; +use OCP\Migration\SimpleMigrationStep; + + +class Version12000Date20210610232111 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_federated_rooms')) { + $table = $schema->createTable('talk_federated_rooms'); + $table->addColumn('id', Types::BIGINT, [ + 'autoincrement' => true, + 'notnull' => true, + ]); + $table->addColumn('room_id', Types::BIGINT, [ + 'notnull' => true, + 'unsigned' => true, + ]); + $table->addColumn('instance_url', Types::TEXT, [ + 'notnull' => true, + ]); + $table->addColumn('password', Types::TEXT, [ + 'notnull' => true, + ]); + $table->setPrimaryKey('id'); + } + + return $schema; + } +}