Completed
Push — master ( 02e5e5...868d49 )
by Daniel
11:13
created

m5_add_cblocks_schema   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 57
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0
Metric Value
wmc 4
lcom 0
cbo 0
dl 0
loc 57
rs 10
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
class m5_add_cblocks_schema extends \phpbb\db\migration\migration
13
{
14
	/**
15
	 * Skip this migration if the sm_cblocks table already exists
16
	 *
17
	 * @return bool True to skip this migration, false to run it
18
	 * @access public
19
	 */
20
	public function effectively_installed()
21
	{
22
		return $this->db_tools->sql_table_exists($this->table_prefix . 'sm_cblocks');
23
	}
24
25
	/**
26
	 * @inheritdoc
27
	 */
28
	public static function depends_on()
29
	{
30
		return array(
31
			'\blitze\sitemaker\migrations\v20x\m1_initial_schema',
32
		);
33
	}
34
35
	/**
36
	 * @inheritdoc
37
	 */
38
	public function update_schema()
39
	{
40
		return array(
41
			'add_tables'	=> array(
42
				$this->table_prefix . 'sm_cblocks' => array(
43
					'COLUMNS'		=> array(
44
						'block_id'			=> array('UINT', null, 'auto_increment'),
45
						'block_content'		=> array('TEXT_UNI', ''),
46
						'bbcode_bitfield'	=> array('VCHAR:255', ''),
47
						'bbcode_options'	=> array('UINT:11', 7),
48
						'bbcode_uid'		=> array('VCHAR:8', ''),
49
					),
50
51
					'PRIMARY_KEY'	=> 'block_id'
52
				),
53
			),
54
		);
55
	}
56
57
	/**
58
	 * @inheritdoc
59
	 */
60
	public function revert_schema()
61
	{
62
		return array(
63
			'drop_tables'	=> array(
64
				$this->table_prefix . 'sm_cblocks',
65
			),
66
		);
67
	}
68
}
69