Completed
Pull Request — master (#490)
by
unknown
01:54
created

Version1803Date20181208221653   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 0
dl 0
loc 40
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A preSchemaChange() 0 2 1
A changeSchema() 0 15 2
A postSchemaChange() 0 2 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace OCA\Gallery\Migration;
6
7
use Closure;
8
use OCP\DB\ISchemaWrapper;
9
use OCP\Migration\SimpleMigrationStep;
10
use OCP\Migration\IOutput;
11
12
/**
13
 * Auto-generated migration step: Please modify to your needs!
14
 */
15
class Version1803Date20181208221653 extends SimpleMigrationStep {
16
17
	/**
18
	 * @param IOutput $output
19
	 * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
20
	 * @param array $options
21
	 */
22
	public function preSchemaChange(IOutput $output, Closure $schemaClosure, array $options) {
23
	}
24
25
	/**
26
	 * @param IOutput $output
27
	 * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
28
	 * @param array $options
29
	 * @return null|ISchemaWrapper
30
	 */
31
	public function changeSchema(IOutput $output, Closure $schemaClosure, array $options) {
32
		/** @var ISchemaWrapper $schema */
33
		$schema = $schemaClosure();
34
35
		if (!$schema->hasTable('gallery_file_properties')) {
36
			$table = $schema->createTable('gallery_file_properties');
37
			$table->addColumn('id', 'integer', [
38
				'notnull' => true,
39
			]);
40
			$table->addColumn('modifications', 'string', [
41
				'notnull' => false,
42
			]);
43
		}
44
		return $schema;
45
	}
46
47
	/**
48
	 * @param IOutput $output
49
	 * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
50
	 * @param array $options
51
	 */
52
	public function postSchemaChange(IOutput $output, Closure $schemaClosure, array $options) {
53
	}
54
}
55