Completed
Push — develop-0.9 ( 3c00b3...763dab )
by René
12s
created

Version009000Date20180501201949::changeSchema()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 11
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 6
nc 1
nop 3
dl 0
loc 11
rs 10
c 0
b 0
f 0
1
<?php
2
namespace OCA\Polls\Migration;
3
4
use Doctrine\DBAL\Exception\TableNotFoundException;
0 ignored issues
show
Bug introduced by
The type Doctrine\DBAL\Exception\TableNotFoundException was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
5
use Doctrine\DBAL\Platforms\PostgreSqlPlatform;
0 ignored issues
show
Bug introduced by
The type Doctrine\DBAL\Platforms\PostgreSqlPlatform was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
6
use Doctrine\DBAL\Types\Type;
0 ignored issues
show
Bug introduced by
The type Doctrine\DBAL\Types\Type was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
7
use OCP\DB\ISchemaWrapper;
0 ignored issues
show
Bug introduced by
The type OCP\DB\ISchemaWrapper was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
8
use OCP\IDBConnection;
9
use OCP\IConfig;
10
use OCP\Migration\SimpleMigrationStep;
0 ignored issues
show
Bug introduced by
The type OCP\Migration\SimpleMigrationStep was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
11
use OCP\Migration\IOutput;
12
13
/**
14
 * Adding timestamp to options table
15
 */
16
class Version009000Date20180501201949 extends SimpleMigrationStep {
17
	/** @var IDBConnection */
18
	protected $connection;
19
	
20
	/** @var IConfig */
21
	protected $config;
22
	
23
	/**
24
	 * @param IDBConnection $connection
25
	 * @param IConfig $config
26
	 */
27
	public function __construct(IDBConnection $connection, IConfig $config) {
28
		$this->connection = $connection;
29
		$this->config = $config;
30
	}
31
	/**
32
	 * @param IOutput $output
33
	 * @param \Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
34
	 * @param array $options
35
	 * @since 13.0.0
36
	 */
37
	public function preSchemaChange(IOutput $output, \Closure $schemaClosure, array $options) {
38
	}
39
40
	/**
41
	 * @param IOutput $output
42
	 * @param \Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
43
	 * @param array $options
44
	 * @return null|ISchemaWrapper
45
	 * @since 13.0.0
46
	 */
47
	public function changeSchema(IOutput $output, \Closure $schemaClosure, array $options) {
48
		/** @var ISchemaWrapper $schema */
49
		$schema = $schemaClosure();
50
51
		$table = $schema->getTable('polls_options');
52
		$table->addColumn('timestamp', Type::INTEGER, [
53
			'notnull' => false,
54
			'default' => 0
55
		]);
56
57
		return $schema;
58
	}
59
60
	/**
61
	 * @param IOutput $output
62
	 * @param \Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
63
	 * @param array $options
64
	 * @since 13.0.0
65
	 */
66
	public function postSchemaChange(IOutput $output, \Closure $schemaClosure, array $options) {
67
	}
68
}
69