|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* @author Viktar Dubiniuk <[email protected]> |
|
4
|
|
|
* |
|
5
|
|
|
* @copyright Copyright (c) 2017, ownCloud GmbH |
|
6
|
|
|
* @license AGPL-3.0 |
|
7
|
|
|
* |
|
8
|
|
|
* This code is free software: you can redistribute it and/or modify |
|
9
|
|
|
* it under the terms of the GNU Affero General Public License, version 3, |
|
10
|
|
|
* as published by the Free Software Foundation. |
|
11
|
|
|
* |
|
12
|
|
|
* This program is distributed in the hope that it will be useful, |
|
13
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
14
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
15
|
|
|
* GNU Affero General Public License for more details. |
|
16
|
|
|
* |
|
17
|
|
|
* You should have received a copy of the GNU Affero General Public License, version 3, |
|
18
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/> |
|
19
|
|
|
* |
|
20
|
|
|
*/ |
|
21
|
|
|
|
|
22
|
|
|
namespace OCA\DAV\Migrations; |
|
23
|
|
|
|
|
24
|
|
|
use OCP\Migration\ISchemaMigration; |
|
25
|
|
|
use Doctrine\DBAL\Schema\Schema; |
|
26
|
|
|
use Doctrine\DBAL\Types\Type; |
|
27
|
|
|
|
|
28
|
|
|
/* |
|
29
|
|
|
* Create dav_properties table that stores properties |
|
30
|
|
|
* of non-fs items (calendar/contacts) by path |
|
31
|
|
|
*/ |
|
32
|
|
|
|
|
33
|
|
|
class Version20170927201245 implements ISchemaMigration { |
|
34
|
|
|
|
|
35
|
|
|
/** |
|
36
|
|
|
* @param Schema $schema |
|
37
|
|
|
* @param array $options |
|
38
|
|
|
*/ |
|
39
|
|
|
public function changeSchema(Schema $schema, array $options) { |
|
40
|
|
|
$prefix = $options['tablePrefix']; |
|
41
|
|
|
if (!$schema->hasTable("${prefix}dav_properties")){ |
|
42
|
|
|
$table = $schema->createTable("${prefix}dav_properties"); |
|
43
|
|
|
$table->addColumn('id', Type::BIGINT, [ |
|
44
|
|
|
'autoincrement' => true, |
|
45
|
|
|
'notnull' => true, |
|
46
|
|
|
'length' => 20, |
|
47
|
|
|
]); |
|
48
|
|
|
$table->addColumn('propertypath', Type::STRING, [ |
|
49
|
|
|
'notnull' => true, |
|
50
|
|
|
'length' => 255, |
|
51
|
|
|
'default' => '', |
|
52
|
|
|
]); |
|
53
|
|
|
$table->addColumn('propertyname', Type::STRING, [ |
|
54
|
|
|
'notnull' => true, |
|
55
|
|
|
'length' => 255, |
|
56
|
|
|
'default' => '', |
|
57
|
|
|
]); |
|
58
|
|
|
$table->addColumn('propertyvalue', Type::STRING, [ |
|
59
|
|
|
'notnull' => true, |
|
60
|
|
|
'length' => 255, |
|
61
|
|
|
]); |
|
62
|
|
|
$table->setPrimaryKey(['id']); |
|
63
|
|
|
$table->addIndex(['propertypath'], 'propertypath_index'); |
|
64
|
|
|
} |
|
65
|
|
|
} |
|
66
|
|
|
} |
|
67
|
|
|
|