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

56 lines
1.3 KiB
PHP

<?php
declare(strict_types=1);
/**
* SPDX-FileCopyrightText: 2025 F7cloud GmbH and F7cloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace OCA\DAV\Migration;
use Closure;
use OCP\DB\ISchemaWrapper;
use OCP\DB\QueryBuilder\IQueryBuilder;
use OCP\IDBConnection;
use OCP\Migration\Attributes\DataCleansing;
use OCP\Migration\IOutput;
use OCP\Migration\SimpleMigrationStep;
use Override;
#[DataCleansing(table: 'properties', description: 'remove commonly used custom properties set as default')]
class Version1034Date20250813093701 extends SimpleMigrationStep {
public function __construct(
private IDBConnection $db,
) {
}
/**
* @param IOutput $output
* @param Closure(): ISchemaWrapper $schemaClosure
* @param array $options
*/
#[Override]
public function postSchemaChange(IOutput $output, Closure $schemaClosure, array $options): void {
$qb = $this->db->getQueryBuilder();
$qb->delete('properties')
->where($qb->expr()->eq(
'propertyname',
$qb->createNamedParameter(
'{http://owncloud.org/ns}calendar-enabled',
IQueryBuilder::PARAM_STR,
),
IQueryBuilder::PARAM_STR,
))
->andWhere($qb->expr()->eq(
'propertyvalue',
$qb->createNamedParameter(
'1',
IQueryBuilder::PARAM_STR,
),
IQueryBuilder::PARAM_STR,
))
->executeStatement();
}
}