mirror of
https://github.com/chenasraf/nextcloud-pantry.git
synced 2026-05-18 01:28:57 +00:00
43 lines
1.1 KiB
PHP
43 lines
1.1 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
// SPDX-FileCopyrightText: Chen Asraf <contact@casraf.dev>
|
|
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
|
|
namespace OCA\Pantry\Migration;
|
|
|
|
use Closure;
|
|
use OCA\Pantry\AppInfo\Application;
|
|
use OCP\DB\ISchemaWrapper;
|
|
use OCP\DB\Types;
|
|
use OCP\Migration\IOutput;
|
|
use OCP\Migration\SimpleMigrationStep;
|
|
|
|
/**
|
|
* Add delete_on_done flag to checklist items ("Once" items that are removed
|
|
* from the list when marked done).
|
|
*/
|
|
class Version3Date20260416000000 extends SimpleMigrationStep {
|
|
/**
|
|
* @param Closure():ISchemaWrapper $schemaClosure
|
|
*/
|
|
public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper {
|
|
/** @var ISchemaWrapper $schema */
|
|
$schema = $schemaClosure();
|
|
|
|
$itemsTable = Application::tableName('list_items');
|
|
if ($schema->hasTable($itemsTable)) {
|
|
$table = $schema->getTable($itemsTable);
|
|
if (!$table->hasColumn('delete_on_done')) {
|
|
$table->addColumn('delete_on_done', Types::BOOLEAN, [
|
|
'notnull' => false,
|
|
'default' => false,
|
|
]);
|
|
}
|
|
}
|
|
|
|
return $schema;
|
|
}
|
|
}
|