2019-10-14 14:55:39 +00:00
|
|
|
<?php
|
2019-12-03 18:57:53 +00:00
|
|
|
|
2019-10-14 14:55:39 +00:00
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
/**
|
2024-05-24 17:43:47 +00:00
|
|
|
* SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors
|
|
|
|
* SPDX-License-Identifier: AGPL-3.0-or-later
|
2019-10-14 14:55:39 +00:00
|
|
|
*/
|
|
|
|
namespace OC\Core\Migrations;
|
|
|
|
|
|
|
|
use Closure;
|
|
|
|
use OCP\DB\ISchemaWrapper;
|
2021-01-12 09:20:12 +00:00
|
|
|
use OCP\DB\Types;
|
2019-10-14 14:55:39 +00:00
|
|
|
use OCP\IDBConnection;
|
|
|
|
use OCP\Migration\IOutput;
|
|
|
|
use OCP\Migration\SimpleMigrationStep;
|
|
|
|
|
|
|
|
class Version18000Date20191014105105 extends SimpleMigrationStep {
|
2023-06-23 19:20:49 +00:00
|
|
|
public function __construct(
|
|
|
|
protected IDBConnection $connection,
|
|
|
|
) {
|
2019-10-14 14:55:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @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): ?ISchemaWrapper {
|
|
|
|
/** @var ISchemaWrapper $schema */
|
|
|
|
$schema = $schemaClosure();
|
2019-11-25 13:09:38 +00:00
|
|
|
$table = $schema->createTable('direct_edit');
|
2019-10-14 14:55:39 +00:00
|
|
|
|
2020-06-30 20:12:06 +00:00
|
|
|
$table->addColumn('id', Types::BIGINT, [
|
2019-11-25 13:09:38 +00:00
|
|
|
'autoincrement' => true,
|
|
|
|
'notnull' => true,
|
|
|
|
]);
|
2020-06-30 20:12:06 +00:00
|
|
|
$table->addColumn('editor_id', Types::STRING, [
|
2019-11-25 13:09:38 +00:00
|
|
|
'notnull' => true,
|
|
|
|
'length' => 64,
|
|
|
|
]);
|
2020-06-30 20:12:06 +00:00
|
|
|
$table->addColumn('token', Types::STRING, [
|
2019-11-25 13:09:38 +00:00
|
|
|
'notnull' => true,
|
|
|
|
'length' => 64,
|
|
|
|
]);
|
2020-06-30 20:12:06 +00:00
|
|
|
$table->addColumn('file_id', Types::BIGINT, [
|
2019-11-25 13:09:38 +00:00
|
|
|
'notnull' => true,
|
|
|
|
]);
|
2020-06-30 20:12:06 +00:00
|
|
|
$table->addColumn('user_id', Types::STRING, [
|
2019-11-25 13:09:38 +00:00
|
|
|
'notnull' => false,
|
|
|
|
'length' => 64,
|
|
|
|
]);
|
2020-06-30 20:12:06 +00:00
|
|
|
$table->addColumn('share_id', Types::BIGINT, [
|
2019-11-25 13:09:38 +00:00
|
|
|
'notnull' => false
|
|
|
|
]);
|
2020-06-30 20:12:06 +00:00
|
|
|
$table->addColumn('timestamp', Types::BIGINT, [
|
2019-11-25 13:09:38 +00:00
|
|
|
'notnull' => true,
|
|
|
|
'length' => 20,
|
|
|
|
'unsigned' => true,
|
|
|
|
]);
|
2020-06-30 20:12:06 +00:00
|
|
|
$table->addColumn('accessed', Types::BOOLEAN, [
|
2020-11-11 13:46:06 +00:00
|
|
|
'notnull' => false,
|
2019-11-25 13:09:38 +00:00
|
|
|
'default' => false
|
|
|
|
]);
|
2019-10-14 14:55:39 +00:00
|
|
|
|
2019-11-25 13:09:38 +00:00
|
|
|
$table->setPrimaryKey(['id']);
|
|
|
|
$table->addIndex(['token']);
|
2022-02-07 08:25:27 +00:00
|
|
|
$table->addIndex(['timestamp'], 'direct_edit_timestamp');
|
2019-10-14 14:55:39 +00:00
|
|
|
|
|
|
|
return $schema;
|
|
|
|
}
|
|
|
|
}
|