-
-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Expand file tree
/
Copy pathVersion1039Date20260408000000.php
More file actions
52 lines (42 loc) · 1.52 KB
/
Version1039Date20260408000000.php
File metadata and controls
52 lines (42 loc) · 1.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<?php
declare(strict_types=1);
/**
* SPDX-FileCopyrightText: 2026 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace OCA\DAV\Migration;
use Closure;
use OCP\DB\ISchemaWrapper;
use OCP\DB\Types;
use OCP\Migration\Attributes\AddColumn;
use OCP\Migration\Attributes\ColumnType;
use OCP\Migration\Attributes\DropColumn;
use OCP\Migration\IOutput;
use OCP\Migration\SimpleMigrationStep;
#[DropColumn(table: 'calendars', name: 'default_alarm', description: 'Replaced by default_alarm_pday and default_alarm_fday')]
#[AddColumn(table: 'calendars', name: 'default_alarm_pday', type: ColumnType::INTEGER)]
#[AddColumn(table: 'calendars', name: 'default_alarm_fday', type: ColumnType::INTEGER)]
class Version1039Date20260408000000 extends SimpleMigrationStep {
#[\Override]
public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper {
/** @var ISchemaWrapper $schema */
$schema = $schemaClosure();
$calendarsTable = $schema->getTable('calendars');
if ($calendarsTable->hasColumn('default_alarm')) {
$calendarsTable->dropColumn('default_alarm');
}
if (!$calendarsTable->hasColumn('default_alarm_pday')) {
$calendarsTable->addColumn('default_alarm_pday', Types::INTEGER, [
'notnull' => false,
'default' => null,
]);
}
if (!$calendarsTable->hasColumn('default_alarm_fday')) {
$calendarsTable->addColumn('default_alarm_fday', Types::INTEGER, [
'notnull' => false,
'default' => null,
]);
}
return $schema;
}
}