Completed
Pull Request — master (#184)
by Joas
23:54
created

Version2006000Date20170808155040::changeSchema()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 10
ccs 0
cts 7
cp 0
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 6
nc 1
nop 3
crap 2
1
<?php
2
namespace OCA\Activity\Migration;
3
4
use Doctrine\DBAL\Schema\Schema;
5
use OCP\Migration\SimpleMigrationStep;
6
use OCP\Migration\IOutput;
7
8
class Version2006000Date20170808155040 extends SimpleMigrationStep {
9
10
	/**
11
	 * @param IOutput $output
12
	 * @param \Closure $schemaClosure The `\Closure` returns a `Schema`
13
	 * @param array $options
14
	 * @since 13.0.0
15
	 */
16
	public function preSchemaChange(IOutput $output, \Closure $schemaClosure, array $options) {
17
	}
18
19
	/**
20
	 * @param IOutput $output
21
	 * @param \Closure $schemaClosure The `\Closure` returns a `Schema`
22
	 * @param array $options
23
	 * @return null|Schema
24
	 * @throws \Doctrine\DBAL\Schema\SchemaException
25
	 * @since 13.0.0
26
	 */
27
	public function changeSchema(IOutput $output, \Closure $schemaClosure, array $options) {
28
		/** @var Schema $schema */
29
		$schema = $schemaClosure();
30
31
		$table = $schema->getTable('activity');
32
		$table->dropIndex('activity_filter_app');
33
		$table->addIndex(['affecteduser', 'type', 'app', 'timestamp'], 'activity_filter');
34
35
		return $schema;
36
	}
37
38
	/**
39
	 * @param IOutput $output
40
	 * @param \Closure $schemaClosure The `\Closure` returns a `Schema`
41
	 * @param array $options
42
	 * @since 13.0.0
43
	 */
44
	public function postSchemaChange(IOutput $output, \Closure $schemaClosure, array $options) {
45
	}
46
}
47