Passed
Push — release-3.0.0 ( e3b06e...069487 )
by Daniel
02:55
created

m6_update_comments   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 49
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 19
c 1
b 0
f 0
dl 0
loc 49
rs 10
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A revert_schema() 0 12 1
A depends_on() 0 4 1
A update_schema() 0 12 1
1
<?php
2
/**
3
 *
4
 * @package sitemaker
5
 * @copyright (c) 2019 Daniel A. (blitze)
6
 * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
7
 *
8
 */
9
10
namespace blitze\content\migrations\v30x;
11
12
class m6_update_comments extends \phpbb\db\migration\migration
13
{
14
	/**
15
	 * @inheritdoc
16
	 */
17
	public static function depends_on()
18
	{
19
		return array(
20
			'\blitze\content\migrations\v30x\m1_initial_schema',
21
		);
22
	}
23
24
	/**
25
	 * @return array Array of table schema
26
	 * @access public
27
	 */
28
	public function update_schema()
29
	{
30
		return array(
31
			'drop_columns'	=> array(
32
				$this->table_prefix . 'sm_content_types'	=> array(
33
					'allow_comments',
34
				),
35
			),
36
			'add_columns'	=> array(
37
				$this->table_prefix . 'sm_content_types'	=> array(
38
					'comments'			=> array('VCHAR:155', '', 'after' => 'content_view_settings'),
39
					'comments_settings'	=> array('VCHAR:255', '', 'after' => 'comments'),
40
				),
41
			),
42
		);
43
	}
44
45
	/**
46
	 * @return array Array of table schema
47
	 * @access public
48
	 */
49
	public function revert_schema()
50
	{
51
		return array(
52
			'add_columns'	=> array(
53
				$this->table_prefix . 'sm_content_types'	=> array(
54
					'allow_comments'	=> array('BOOL', 1, 'after' => 'req_approval'),
55
				),
56
			),
57
			'drop_columns'	=> array(
58
				$this->table_prefix . 'sm_content_types'	=> array(
59
					'comments',
60
					'comments_settings',
61
				),
62
			),
63
		);
64
	}
65
}
66