mirror of
https://github.com/nextcloud/server.git
synced 2024-12-28 07:58:42 +00:00
5c49a54801
Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
54 lines
1.3 KiB
PHP
54 lines
1.3 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
/**
|
|
* SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors
|
|
* SPDX-License-Identifier: AGPL-3.0-or-later
|
|
*/
|
|
namespace OC\Core\Migrations;
|
|
|
|
use Closure;
|
|
use OCP\DB\ISchemaWrapper;
|
|
use OCP\IDBConnection;
|
|
use OCP\Migration\IOutput;
|
|
use OCP\Migration\SimpleMigrationStep;
|
|
|
|
class Version16000Date20190427105638 extends SimpleMigrationStep {
|
|
public function __construct(
|
|
private IDBConnection $connection,
|
|
) {
|
|
}
|
|
|
|
/**
|
|
* @param IOutput $output
|
|
* @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
|
|
* @param array $options
|
|
*/
|
|
public function preSchemaChange(IOutput $output, Closure $schemaClosure, array $options) {
|
|
$this->connection
|
|
->getQueryBuilder()
|
|
->delete('collres_accesscache')
|
|
->execute();
|
|
}
|
|
|
|
/**
|
|
* @param IOutput $output
|
|
* @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
|
|
* @param array $options
|
|
* @return null|ISchemaWrapper
|
|
* @throws \Doctrine\DBAL\Schema\SchemaException
|
|
*/
|
|
public function changeSchema(IOutput $output, Closure $schemaClosure, array $options) {
|
|
/** @var ISchemaWrapper $schema */
|
|
$schema = $schemaClosure();
|
|
|
|
if ($schema->hasTable('collres_accesscache')) {
|
|
$table = $schema->getTable('collres_accesscache');
|
|
$table->dropColumn('access');
|
|
}
|
|
|
|
return $schema;
|
|
}
|
|
}
|