1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* @author Vincent Petry <[email protected]> |
4
|
|
|
* |
5
|
|
|
* @copyright Copyright (c) 2018, 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\activity\Migrations; |
23
|
|
|
|
24
|
|
|
use Doctrine\DBAL\Schema\Schema; |
25
|
|
|
use Doctrine\DBAL\Types\Type; |
26
|
|
|
use OCP\Migration\ISchemaMigration; |
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* Adds migrations that were missing when running update. |
30
|
|
|
* |
31
|
|
|
* - set type to "longtext" for "subjectparams" and "messageparams" by increasing length |
32
|
|
|
* |
33
|
|
|
*/ |
34
|
|
|
class Version20181019151118 implements ISchemaMigration { |
35
|
|
|
/** |
36
|
|
|
* @param Schema $schema |
37
|
|
|
* @param array $options |
38
|
|
|
*/ |
39
|
|
|
public function changeSchema(Schema $schema, array $options) { |
40
|
|
|
$prefix = $options['tablePrefix']; |
41
|
|
|
|
42
|
|
|
$activityTable = $schema->getTable("{$prefix}activity"); |
43
|
|
|
|
44
|
|
|
if (!$activityTable->hasIndex('activity_time')) { |
45
|
|
|
$activityTable->addIndex( |
46
|
|
|
['timestamp'], |
47
|
|
|
'activity_time' |
48
|
|
|
); |
49
|
|
|
} |
50
|
|
|
|
51
|
|
|
if (!$activityTable->hasIndex('activity_object')) { |
52
|
|
|
$activityTable->addIndex( |
53
|
|
|
['object_type', 'object_id'], |
54
|
|
|
'activity_object' |
55
|
|
|
); |
56
|
|
|
} |
57
|
|
|
} |
58
|
|
|
} |
59
|
|
|
|