1
|
|
|
<?php |
2
|
|
|
declare(strict_types=1); |
3
|
|
|
/** |
4
|
|
|
* @copyright 2019, Georg Ehrke <[email protected]> |
5
|
|
|
* |
6
|
|
|
* @author Georg Ehrke <[email protected]> |
7
|
|
|
* |
8
|
|
|
* @license GNU AGPL version 3 or any later version |
9
|
|
|
* |
10
|
|
|
* This program is free software: you can redistribute it and/or modify |
11
|
|
|
* it under the terms of the GNU Affero General Public License as |
12
|
|
|
* published by the Free Software Foundation, either version 3 of the |
13
|
|
|
* License, or (at your option) any later version. |
14
|
|
|
* |
15
|
|
|
* This program is distributed in the hope that it will be useful, |
16
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
17
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
18
|
|
|
* GNU Affero General Public License for more details. |
19
|
|
|
* |
20
|
|
|
* You should have received a copy of the GNU Affero General Public License |
21
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
22
|
|
|
* |
23
|
|
|
*/ |
24
|
|
|
namespace OCA\DAV\Migration; |
25
|
|
|
|
26
|
|
|
use Doctrine\DBAL\Types\Type; |
27
|
|
|
use OCP\DB\ISchemaWrapper; |
28
|
|
|
use OCP\Migration\SimpleMigrationStep; |
29
|
|
|
use OCP\Migration\IOutput; |
30
|
|
|
|
31
|
|
|
/** |
32
|
|
|
* Auto-generated migration step: Please modify to your needs! |
33
|
|
|
*/ |
34
|
|
|
class Version1012Date20190808122342 extends SimpleMigrationStep { |
35
|
|
|
|
36
|
|
|
/** |
37
|
|
|
* @param IOutput $output |
38
|
|
|
* @param \Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` |
39
|
|
|
* @param array $options |
40
|
|
|
* @return null|ISchemaWrapper |
41
|
|
|
* @since 13.0.0 |
42
|
|
|
*/ |
43
|
|
|
public function changeSchema(IOutput $output, |
44
|
|
|
\Closure $schemaClosure, |
45
|
|
|
array $options):?ISchemaWrapper { |
46
|
|
|
/** @var ISchemaWrapper $schema */ |
47
|
|
|
$schema = $schemaClosure(); |
48
|
|
|
|
49
|
|
|
if (!$schema->hasTable('calendar_reminders')) { |
50
|
|
|
$table = $schema->createTable('calendar_reminders'); |
51
|
|
|
|
52
|
|
|
$table->addColumn('id', Type::BIGINT, [ |
53
|
|
|
'autoincrement' => true, |
54
|
|
|
'notnull' => true, |
55
|
|
|
'length' => 11, |
56
|
|
|
'unsigned' => true, |
57
|
|
|
]); |
58
|
|
|
$table->addColumn('calendar_id', Type::BIGINT, [ |
59
|
|
|
'notnull' => true, |
60
|
|
|
'length' => 11, |
61
|
|
|
]); |
62
|
|
|
$table->addColumn('object_id', Type::BIGINT, [ |
63
|
|
|
'notnull' => true, |
64
|
|
|
'length' => 11, |
65
|
|
|
]); |
66
|
|
|
$table->addColumn('is_recurring', Type::SMALLINT, [ |
67
|
|
|
'notnull' => true, |
68
|
|
|
'length' => 1, |
69
|
|
|
]); |
70
|
|
|
$table->addColumn('uid', Type::STRING, [ |
71
|
|
|
'notnull' => true, |
72
|
|
|
'length' => 255, |
73
|
|
|
]); |
74
|
|
|
$table->addColumn('recurrence_id', Type::BIGINT, [ |
75
|
|
|
'notnull' => false, |
76
|
|
|
'length' => 11, |
77
|
|
|
'unsigned' => true, |
78
|
|
|
]); |
79
|
|
|
$table->addColumn('is_recurrence_exception', Type::SMALLINT, [ |
80
|
|
|
'notnull' => true, |
81
|
|
|
'length' => 1, |
82
|
|
|
]); |
83
|
|
|
$table->addColumn('event_hash', Type::STRING, [ |
84
|
|
|
'notnull' => true, |
85
|
|
|
'length' => 255, |
86
|
|
|
]); |
87
|
|
|
$table->addColumn('alarm_hash', Type::STRING, [ |
88
|
|
|
'notnull' => true, |
89
|
|
|
'length' => 255, |
90
|
|
|
]); |
91
|
|
|
$table->addColumn('type', Type::STRING, [ |
92
|
|
|
'notnull' => true, |
93
|
|
|
'length' => 255, |
94
|
|
|
]); |
95
|
|
|
$table->addColumn('is_relative', Type::SMALLINT, [ |
96
|
|
|
'notnull' => true, |
97
|
|
|
'length' => 1, |
98
|
|
|
]); |
99
|
|
|
$table->addColumn('notification_date', Type::BIGINT, [ |
100
|
|
|
'notnull' => true, |
101
|
|
|
'length' => 11, |
102
|
|
|
'unsigned' => true, |
103
|
|
|
]); |
104
|
|
|
$table->addColumn('is_repeat_based', Type::SMALLINT, [ |
105
|
|
|
'notnull' => true, |
106
|
|
|
'length' => 1, |
107
|
|
|
]); |
108
|
|
|
|
109
|
|
|
$table->setPrimaryKey(['id']); |
110
|
|
|
$table->addIndex(['object_id'], 'calendar_reminder_objid'); |
111
|
|
|
$table->addIndex(['uid', 'recurrence_id'], 'calendar_reminder_uidrec'); |
112
|
|
|
|
113
|
|
|
return $schema; |
114
|
|
|
} |
115
|
|
|
} |
116
|
|
|
} |
117
|
|
|
|