Passed
Branch master (d4fa65)
by Matt
15:12 queued 12:46
created

m5_end_date   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 50
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 13
c 0
b 0
f 0
dl 0
loc 50
rs 10
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A update_schema() 0 6 1
A revert_schema() 0 6 1
A effectively_installed() 0 3 1
A depends_on() 0 5 1
1
<?php
2
/**
3
 *
4
 * Advertisement management. An extension for the phpBB Forum Software package.
5
 *
6
 * @copyright (c) 2017 phpBB Limited <https://www.phpbb.com>
7
 * @license GNU General Public License, version 2 (GPL-2.0)
8
 *
9
 */
10
11
namespace phpbb\ads\migrations\v10x;
12
13
class m5_end_date extends \phpbb\db\migration\migration
0 ignored issues
show
Bug introduced by
The type phpbb\db\migration\migration 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...
14
{
15
	/**
16
	 * {@inheritDoc}
17
	 */
18
	public function effectively_installed()
19
	{
20
		return $this->db_tools->sql_column_exists($this->table_prefix . 'ads', 'ad_end_date');
21
	}
22
23
	/**
24
	 * {@inheritDoc}
25
	 */
26
	public static function depends_on()
27
	{
28
		return array(
29
			'\phpbb\ads\migrations\v10x\m1_initial_schema',
30
			'\phpbb\ads\migrations\v10x\m4_indexes',
31
		);
32
	}
33
34
	/**
35
	 * Add the end date to ads table
36
	 *
37
	 * @return array Array of table schema
38
	 * @access public
39
	 */
40
	public function update_schema()
41
	{
42
		return array(
43
			'add_columns' => array(
44
				$this->table_prefix . 'ads' => array(
45
					'ad_end_date' => array('TIMESTAMP', 0),
46
				),
47
			),
48
		);
49
	}
50
51
	/**
52
	 * Drop the end date from ads table
53
	 *
54
	 * @return array Array of table schema
55
	 * @access public
56
	 */
57
	public function revert_schema()
58
	{
59
		return array(
60
			'drop_columns' => array(
61
				$this->table_prefix . 'ads' => array(
62
					'ad_end_date',
63
				),
64
			),
65
		);
66
	}
67
}
68