You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
nextcloud-server/apps/dav/lib/Migration/Version1005Date201804130931...

64 lines
1.6 KiB

<?php
declare(strict_types=1);
/**
* SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace OCA\DAV\Migration;
use OCP\DB\ISchemaWrapper;
use OCP\DB\Types;
use OCP\Migration\IOutput;
use OCP\Migration\SimpleMigrationStep;
class Version1005Date20180413093149 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('directlink')) {
$table = $schema->createTable('directlink');
$table->addColumn('id', Types::BIGINT, [
'autoincrement' => true,
'notnull' => true,
'length' => 11,
'unsigned' => true,
]);
$table->addColumn('user_id', Types::STRING, [
'notnull' => false,
'length' => 64,
]);
$table->addColumn('file_id', Types::BIGINT, [
'notnull' => true,
'length' => 11,
'unsigned' => true,
]);
$table->addColumn('token', Types::STRING, [
'notnull' => false,
'length' => 60,
]);
$table->addColumn('expiration', Types::BIGINT, [
'notnull' => true,
'length' => 11,
'unsigned' => true,
]);
$table->setPrimaryKey(['id'], 'directlink_id_idx');
$table->addIndex(['token'], 'directlink_token_idx');
$table->addIndex(['expiration'], 'directlink_expiration_idx');
return $schema;
}
}
}