Passed
Push — release-3.2.0 ( e3b9c5...a662cc )
by Daniel
02:49
created

m12_add_hidden_forum_column   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 49
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 12
c 0
b 0
f 0
dl 0
loc 49
rs 10
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A update_schema() 0 6 1
A effectively_installed() 0 3 1
A depends_on() 0 4 1
A revert_schema() 0 6 1
1
<?php
2
/**
3
 *
4
 * @package sitemaker
5
 * @copyright (c) 2013 Daniel A. (blitze)
6
 * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
7
 *
8
 */
9
10
namespace blitze\sitemaker\migrations\v20x;
11
12
/**
13
 * Initial schema changes needed for Extension installation
14
 */
15
class m12_add_hidden_forum_column extends \phpbb\db\migration\migration
16
{
17
	/**
18
	 * @inheritdoc
19
	 */
20
	public static function depends_on()
21
	{
22
		return array(
23
			'\blitze\sitemaker\migrations\v20x\m1_initial_schema',
24
		);
25
	}
26
27
	/**
28
	 * Skip this migration if the hidden_forum column already exists
29
	 *
30
	 * @return bool True to skip this migration, false to run it
31
	 * @access public
32
	 */
33
	public function effectively_installed()
34
	{
35
		return $this->db_tools->sql_column_exists($this->table_prefix . 'forums', 'hidden_forum');
36
	}
37
38
	/**
39
	 * Update forums table schema
40
	 *
41
	 * @return array Array of table schema
42
	 * @access public
43
	 */
44
	public function update_schema()
45
	{
46
		return array(
47
			'add_columns'	=> array(
48
				$this->table_prefix . 'forums'	=> array(
49
					'hidden_forum'		=> array('BOOL', 0),
50
				),
51
			),
52
		);
53
	}
54
55
	/**
56
	 * @inheritdoc
57
	 */
58
	public function revert_schema()
59
	{
60
		return array(
61
			'drop_columns'	=> array(
62
				$this->table_prefix . 'forums'	=> array(
63
					'hidden_forum',
64
				),
65
			),
66
		);
67
	}
68
}
69