Completed
Branch release-3.2.0 (10f575)
by Daniel
03:11
created

m8_remove_config_table::revert_schema()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 12
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 9
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 12
rs 9.9666
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 m8_remove_config_table 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
			'\blitze\sitemaker\migrations\v20x\m7_update_settings_data',
25
		);
26
	}
27
28
	/**
29
	 * Skip this migration if the sm_blocks_config table does not exist
30
	 *
31
	 * @return bool True to skip this migration, false to run it
32
	 * @access public
33
	 */
34
	public function effectively_installed()
35
	{
36
		return !$this->db_tools->sql_table_exists($this->table_prefix . 'sm_blocks_config');
37
	}
38
39
	/**
40
	 * Update the sm_blocks schema
41
	 *
42
	 * @return array Array of table schema
43
	 * @access public
44
	 */
45
	public function update_schema()
46
	{
47
		return array(
48
			'drop_tables'	=> array(
49
				$this->table_prefix . 'sm_blocks_config',
50
			),
51
		);
52
	}
53
54
	/**
55
	 * Revert schema changes
56
	 *
57
	 * @return array Array of table schema
58
	 * @access public
59
	 */
60
	public function revert_schema()
61
	{
62
		return array(
63
			'add_tables'	=> array(
64
				$this->table_prefix . 'sm_blocks_config' => array(
65
					'COLUMNS'		=> array(
66
						'bid'			=> array('UINT', 0),
67
						'bvar'			=> array('VCHAR', ''),
68
						'bval'			=> array('VCHAR_UNI', ''),
69
					),
70
					'KEYS'			=> array(
71
						'bid'			=> array('INDEX', 'bid'),
72
					),
73
				),
74
			),
75
		);
76
	}
77
}
78