0
0
Fork 0
mirror of https://github.com/nextcloud/server.git synced 2025-02-06 01:20:16 +00:00
nextcloud_server/apps/dav/lib/Migration/Version1005Date20180413093149.php
Andy Scherzinger 9d4b944098
chore: Add SPDX header
Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
2024-05-27 20:11:22 +02:00

64 lines
1.6 KiB
PHP

<?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;
}
}
}