mirror of https://github.com/nextcloud/bookmarks
68 lines
1.8 KiB
PHP
68 lines
1.8 KiB
PHP
<?php
|
|
/*
|
|
* Copyright (c) 2020-2024. The Nextcloud Bookmarks contributors.
|
|
*
|
|
* This file is licensed under the Affero General Public License version 3 or later. See the COPYING file.
|
|
*/
|
|
|
|
namespace OCA\Bookmarks\Migration;
|
|
|
|
use Closure;
|
|
use Doctrine\DBAL\Schema\SchemaException;
|
|
use OCP\DB\ISchemaWrapper;
|
|
use OCP\IDBConnection;
|
|
use OCP\Migration\IOutput;
|
|
use OCP\Migration\SimpleMigrationStep;
|
|
|
|
/**
|
|
* Auto-generated migration step: Please modify to your needs!
|
|
*/
|
|
class Version003000000Date20191129094721 extends SimpleMigrationStep {
|
|
private $db;
|
|
|
|
public function __construct(IDBConnection $db) {
|
|
$this->db = $db;
|
|
}
|
|
|
|
/**
|
|
* @param IOutput $output
|
|
* @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
|
|
* @param array $options
|
|
*
|
|
* @return void
|
|
*/
|
|
public function preSchemaChange(IOutput $output, Closure $schemaClosure, array $options) {
|
|
}
|
|
|
|
/**
|
|
* @param IOutput $output
|
|
* @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
|
|
* @param array $options
|
|
*
|
|
* @return ISchemaWrapper
|
|
*
|
|
* @throws SchemaException
|
|
*/
|
|
public function changeSchema(IOutput $output, Closure $schemaClosure, array $options) {
|
|
/** @var ISchemaWrapper $schema */
|
|
$schema = $schemaClosure();
|
|
$schema->dropTable('bookmarks_folders_bookmarks');
|
|
$table = $schema->getTable('bookmarks');
|
|
$table->addIndex(['lastmodified'], 'bookmarks_modified');
|
|
$table = $schema->getTable('bookmarks_folders');
|
|
$table->dropColumn('parent_folder');
|
|
$table->dropColumn('index');
|
|
return $schema;
|
|
}
|
|
|
|
/**
|
|
* @param IOutput $output
|
|
* @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
|
|
* @param array $options
|
|
*
|
|
* @return void
|
|
*/
|
|
public function postSchemaChange(IOutput $output, Closure $schemaClosure, array $options) {
|
|
}
|
|
}
|