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

Version009000Date20180421050115::preSchemaChange()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 1
Code Lines 0

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 0
nc 1
nop 3
dl 0
loc 1
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * @copyright Copyright (c) 2017 Joas Schilling <[email protected]>
4
 *
5
 * @author Joas Schilling <[email protected]>
6
 *
7
 * @license GNU AGPL version 3 or any later version
8
 *
9
 * This program is free software: you can redistribute it and/or modify
10
 * it under the terms of the GNU Affero General Public License as
11
 * published by the Free Software Foundation, either version 3 of the
12
 * License, or (at your option) any later version.
13
 *
14
 * This program is distributed in the hope that it will be useful,
15
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17
 * GNU Affero General Public License for more details.
18
 *
19
 * You should have received a copy of the GNU Affero General Public License
20
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
21
 *
22
 */
23
namespace OCA\Polls\Migration;
24
25
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...
26
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...
27
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...
28
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...
29
use OCP\IConfig;
30
use OCP\IDBConnection;
31
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...
32
use OCP\Migration\IOutput;
33
34
/**
35
 * Auto-generated migration step: Please modify to your needs!
36
 * Adding column 'disallow_maybe' to table 'polls_events'
37
 */
38
class Version009000Date20180421050115 extends SimpleMigrationStep {
39
	/** @var IDBConnection */
40
	protected $connection;
41
	
42
	/** @var IConfig */
43
	protected $config;
44
	
45
	/**
46
	 * @param IDBConnection $connection
47
	 * @param IConfig $config
48
	 */
49
	public function __construct(IDBConnection $connection, IConfig $config) {
50
		$this->connection = $connection;
51
		$this->config = $config;
52
	}
53
	/**
54
	 * @param IOutput $output
55
	 * @param \Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
56
	 * @param array $options
57
	 * @since 13.0.0
58
	 */
59
	public function preSchemaChange(IOutput $output, \Closure $schemaClosure, array $options) {
60
	}
61
62
	/**
63
	 * @param IOutput $output
64
	 * @param \Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
65
	 * @param array $options
66
	 * @return null|ISchemaWrapper
67
	 * @since 13.0.0
68
	 */
69
	public function changeSchema(IOutput $output, \Closure $schemaClosure, array $options) {
70
		/** @var ISchemaWrapper $schema */
71
		$schema = $schemaClosure();
72
73
		$table = $schema->getTable('polls_events');
74
		$table->addColumn('disallow_maybe', Type::INTEGER, [
75
			'notnull' => false,
76
			'default' => 0
77
		]);
78
79
		return $schema;
80
	}
81
82
	/**
83
	 * @param IOutput $output
84
	 * @param \Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
85
	 * @param array $options
86
	 * @since 13.0.0
87
	 */
88
	public function postSchemaChange(IOutput $output, \Closure $schemaClosure, array $options) {
89
	}
90
}
91