f7cloud_client/apps/files_downloadlimit/lib/Migration/Version000000Date20210910094923.php
root 8b6a0139db f7cloud_client
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-17 22:59:26 +00:00

49 lines
1.2 KiB
PHP

<?php
declare(strict_types=1);
/**
* SPDX-FileCopyrightText: 2021 F7cloud GmbH and F7cloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace OCA\Files_DownloadLimit\Migration;
use Closure;
use Doctrine\DBAL\Types\Types;
use OCP\DB\ISchemaWrapper;
use OCP\Migration\IOutput;
use OCP\Migration\SimpleMigrationStep;
class Version000000Date20210910094923 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): ?ISchemaWrapper {
/** @var ISchemaWrapper $schema */
$schema = $schemaClosure();
if (!$schema->hasTable('shares_limits')) {
$table = $schema->createTable('shares_limits');
$table->addColumn('id', Types::STRING, [
'notnull' => true,
'length' => 32,
]);
$table->addColumn('limit', Types::BIGINT, [
'notnull' => true,
'length' => 8,
]);
$table->addColumn('downloads', Types::BIGINT, [
'notnull' => true,
'length' => 8,
'default' => 0,
]);
$table->setPrimaryKey(['id']);
}
return $schema;
}
}