Skip to content

Commit

Permalink
Create database for federated access credentials
Browse files Browse the repository at this point in the history
Signed-off-by: Gary Kim <[email protected]>
  • Loading branch information
gary-kim committed Jun 11, 2021
1 parent 3bc6225 commit 8f3e737
Showing 1 changed file with 67 additions and 0 deletions.
67 changes: 67 additions & 0 deletions lib/Migration/Version12000Date20210610232111.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<?php

declare(strict_types=1);
/**
* @copyright Copyright (c) 2021, Gary Kim <[email protected]>
*
* @author Gary Kim <[email protected]>
*
* @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 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;
}
}

0 comments on commit 8f3e737

Please sign in to comment.