Completed
Pull Request — master (#5)
by Jakub
29:08 queued 26:59
created

m5_end_date::revert_schema()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 10
rs 9.4285
cc 1
eloc 5
nc 1
nop 0
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\admanagement\migrations\v10x;
12
13
/**
14
* Migration stage 1: Initial schema
15
*/
16
class m5_end_date extends \phpbb\db\migration\migration
17
{
18
	/**
19
	* {@inheritDoc}
20
	*/
21
	public function effectively_installed()
22
	{
23
		return $this->db_tools->sql_column_exists($this->table_prefix . 'ads', 'end_date');
24
	}
25
26
	/**
27
	* {@inheritDoc}
28
	*/
29
	static public function depends_on()
1 ignored issue
show
Coding Style introduced by
As per PSR2, the static declaration should come after the visibility declaration.
Loading history...
30
	{
31
		return array('\phpbb\admanagement\migrations\v10x\m4_indexes');
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