Completed
Push — develop ( 6f1d60...1f2a5d )
by Daniel
11:12
created

c3_update_tables::update_schema()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 21
Code Lines 14

Duplication

Lines 0
Ratio 0 %
Metric Value
dl 0
loc 21
rs 9.3142
cc 1
eloc 14
nc 1
nop 0
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\converter;
11
12
/**
13
 * Initial schema changes needed for Extension installation
14
 */
15
class c3_update_tables extends \phpbb\db\migration\migration
16
{
17
	/**
18
	 * Skip this migration if a previous blocks table does not exist
19
	 *
20
	 * @return bool True to skip this migration, false to run it
21
	 * @access public
22
	 */
23
	public function effectively_installed()
24
	{
25
		return !$this->db_tools->sql_table_exists($this->table_prefix . 'blocks');
26
	}
27
28
	/**
29
	 * Update the table name
30
	 *
31
	 * @return array Array of table schema
32
	 * @access public
33
	 */
34
	public function update_schema()
35
	{
36
		return array(
37
			'drop_tables'	=> array(
38
				$this->table_prefix . 'blocks',
39
				$this->table_prefix . 'blocks_config',
40
				$this->table_prefix . 'block_positions',
41
			),
42
			'add_columns'	=> array(
43
				$this->table_prefix . 'menu_items'	=> array(
44
					'depth'		=> array('UINT', 0),
45
				),
46
			),
47
			'drop_columns'	=> array(
48
				$this->table_prefix . 'menus'		=> array('menu_type', 'menu_status'),
49
				$this->table_prefix . 'menu_items'	=> array('item_expanded'),
50
				$this->table_prefix . 'forums'		=> array('module'),
51
				$this->table_prefix . 'users'		=> array('user_week_start'),
52
			),
53
		);
54
	}
55
}
56