Completed
Push — develop-3.2.x ( 26b46b...e41dd4 )
by Matt
06:51
created

v310_m2_remove_schema::update_schema()   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 33
Code Lines 19

Duplication

Lines 0
Ratio 0 %
Metric Value
cc 1
eloc 19
nc 1
nop 0
dl 0
loc 33
rs 8.8571
1
<?php
2
/**
3
*
4
* Advanced BBCode Box
5
*
6
* @copyright (c) 2013 Matt Friedman
7
* @license GNU General Public License, version 2 (GPL-2.0)
8
*
9
*/
10
11
namespace vse\abbc3\migrations;
12
13
/**
14
* This migration removes old schema from 3.0
15
* installations of Advanced BBCode Box 3 MOD.
16
*/
17
class v310_m2_remove_schema extends \phpbb\db\migration\migration
18
{
19
	/**
20
	 * Run migration if abbcode column exists in the bbcodes table
21
	 *
22
	 * @return bool
23
	 */
24
	public function effectively_installed()
25
	{
26
		return !$this->db_tools->sql_column_exists($this->table_prefix . 'bbcodes', 'abbcode');
27
	}
28
29
	/**
30
	 * {@inheritdoc}
31
	 */
32
	static public function depends_on()
33
	{
34
		return array('\vse\abbc3\migrations\v310_m1_remove_data');
35
	}
36
37
	/**
38
	 * {@inheritdoc}
39
	 */
40
	public function update_schema()
41
	{
42
		return array(
43
			'drop_tables'	=> array(
44
				$this->table_prefix . 'clicks',
45
			),
46
47
			'drop_keys'	=> array(
48
				$this->table_prefix . 'bbcodes'		=> array(
49
					'display_order',
50
				),
51
			),
52
53
			'drop_columns'		=> array(
54
				$this->table_prefix . 'users'		=> array(
55
					'user_abbcode_mod',
56
					'user_abbcode_compact',
57
				),
58
				$this->table_prefix . 'bbcodes'		=> array(
59
					'display_on_pm',
60
					'display_on_sig',
61
					'abbcode',
62
					'bbcode_image',
63
				),
64
			),
65
66
			'change_columns'	=> array(
67
				$this->table_prefix . 'bbcodes'		=> array(
68
					'bbcode_id'		=> array('USINT', 0),
69
				),
70
			),
71
		);
72
	}
73
}
74