* * @author Double Bastion LLC * * @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 * License as published by the Free Software Foundation; either * version 3 of the License, or 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 . * */ declare(strict_types=1); namespace OCA\SIPTripPhone\Migration; use Closure; use OCP\DB\Types; use OCP\DB\ISchemaWrapper; use OCP\Migration\IOutput; use OCP\Migration\SimpleMigrationStep; class Version100Date20211106173528 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('sip_trip_phone')) { $table = $schema->createTable('sip_trip_phone'); $table->addColumn('id', Types::BIGINT, [ 'autoincrement' => true, 'notnull' => true, 'length' => 11, 'unsigned' => true, ]); $table->addColumn('user_id', Types::STRING, [ 'notnull' => true, 'length' => 64, 'default' => '', ]); $table->addColumn('pdisplayname', Types::STRING, [ 'notnull' => true, 'length' => 128, 'default' => '', ]); $table->addColumn('sipusername', Types::STRING, [ 'notnull' => true, 'length' => 128, 'default' => '', ]); $table->addColumn('sipuserpassword', Types::STRING, [ 'notnull' => true, 'length' => 2048, 'default' => '', ]); $table->addColumn('stphwssurl', Types::STRING, [ 'notnull' => true, 'length' => 128, 'default' => '', ]); $table->addColumn('siprealm', Types::STRING, [ 'notnull' => true, 'length' => 64, 'default' => '', ]); $table->addColumn('stunserver', Types::STRING, [ 'notnull' => false, 'length' => 256, 'default' => '', ]); $table->setPrimaryKey(['id']); $table->addUniqueIndex(['id']); } return $schema; } }