2019-07-21 14:18:52 +00:00
|
|
|
<?php
|
2020-09-21 12:25:50 +00:00
|
|
|
/*
|
2024-02-02 18:27:50 +00:00
|
|
|
* Copyright (c) 2020-2024. The Nextcloud Bookmarks contributors.
|
2020-09-21 12:25:50 +00:00
|
|
|
*
|
|
|
|
* This file is licensed under the Affero General Public License version 3 or later. See the COPYING file.
|
|
|
|
*/
|
2019-12-28 16:41:31 +00:00
|
|
|
|
2019-07-21 14:18:52 +00:00
|
|
|
namespace OCA\Bookmarks\Migration;
|
|
|
|
|
2020-09-21 12:17:46 +00:00
|
|
|
use Closure;
|
2019-07-21 14:18:52 +00:00
|
|
|
use OCP\DB\ISchemaWrapper;
|
|
|
|
use OCP\IDBConnection;
|
2019-12-28 16:41:31 +00:00
|
|
|
use OCP\Migration\IOutput;
|
|
|
|
use OCP\Migration\SimpleMigrationStep;
|
2019-07-21 14:18:52 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Auto-generated migration step: Please modify to your needs!
|
|
|
|
*/
|
2019-07-21 14:22:40 +00:00
|
|
|
class Version001000007Date20190721094721 extends SimpleMigrationStep {
|
2019-07-21 14:18:52 +00:00
|
|
|
private $db;
|
|
|
|
|
|
|
|
public function __construct(IDBConnection $db) {
|
|
|
|
$this->db = $db;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param IOutput $output
|
2020-09-21 12:17:46 +00:00
|
|
|
* @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
|
2019-07-21 14:18:52 +00:00
|
|
|
* @param array $options
|
2021-01-20 14:42:41 +00:00
|
|
|
*
|
|
|
|
* @return void
|
2019-07-21 14:18:52 +00:00
|
|
|
*/
|
2020-09-21 12:17:46 +00:00
|
|
|
public function preSchemaChange(IOutput $output, Closure $schemaClosure, array $options) {
|
2019-07-21 14:18:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param IOutput $output
|
2020-09-21 12:17:46 +00:00
|
|
|
* @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
|
2019-07-21 14:18:52 +00:00
|
|
|
* @param array $options
|
2021-01-20 14:42:41 +00:00
|
|
|
*
|
|
|
|
* @return ISchemaWrapper
|
2019-07-21 14:18:52 +00:00
|
|
|
*/
|
2020-09-21 12:17:46 +00:00
|
|
|
public function changeSchema(IOutput $output, Closure $schemaClosure, array $options) {
|
2019-07-21 14:18:52 +00:00
|
|
|
/** @var ISchemaWrapper $schema */
|
|
|
|
$schema = $schemaClosure();
|
|
|
|
$table = $schema->getTable('bookmarks');
|
|
|
|
$table->addColumn('last_preview', 'integer', [
|
|
|
|
'notnull' => false,
|
|
|
|
'length' => 4,
|
|
|
|
'default' => 0,
|
|
|
|
'unsigned' => true,
|
|
|
|
]);
|
|
|
|
$table->addIndex(['last_preview']);
|
|
|
|
return $schema;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param IOutput $output
|
2020-09-21 12:17:46 +00:00
|
|
|
* @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
|
2019-07-21 14:18:52 +00:00
|
|
|
* @param array $options
|
2021-01-20 14:42:41 +00:00
|
|
|
*
|
|
|
|
* @return void
|
2019-07-21 14:18:52 +00:00
|
|
|
*/
|
2020-09-21 12:17:46 +00:00
|
|
|
public function postSchemaChange(IOutput $output, Closure $schemaClosure, array $options) {
|
2019-07-21 14:18:52 +00:00
|
|
|
}
|
|
|
|
}
|