. * */ declare(strict_types=1); namespace OCA\Deck\Migration; use Closure; use OCP\DB\ISchemaWrapper; use OCP\Migration\IOutput; use OCP\Migration\SimpleMigrationStep; class Version10900Date202206151724222 extends SimpleMigrationStep { public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper { $schema = $schemaClosure(); if (!$schema->hasTable('deck_sessions')) { $table = $schema->createTable('deck_sessions'); $table->addColumn('id', 'integer', [ 'autoincrement' => true, 'notnull' => true, 'unsigned' => true, ]); $table->addColumn('user_id', 'string', [ 'notnull' => false, 'length' => 64, ]); $table->addColumn('board_id', 'integer', [ 'notnull' => false, ]); $table->addColumn('token', 'string', [ 'notnull' => true, 'length' => 64, ]); $table->addColumn('last_contact', 'integer', [ 'notnull' => true, 'length' => 20, 'unsigned' => true, ]); $table->setPrimaryKey(['id']); $table->addIndex(['token'], 'rd_session_token_idx'); $table->addIndex(['last_contact'], 'ts_lastcontact'); } return $schema; } }