Completed
Pull Request — master (#1)
by Jakub
02:06
created

install_user_schema   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 46
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
c 1
b 0
f 0
lcom 0
cbo 0
dl 0
loc 46
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A effectively_installed() 0 4 1
A depends_on() 0 4 1
A update_schema() 0 19 1
A revert_schema() 0 13 1
1
<?php
2
/**
3
 *
4
 * Advertisement management. An extension for the phpBB Forum Software package.
5
 *
6
 * @copyright (c) 2017 phpBB Limited <https://www.phpbb.com>
7
 * @license GNU General Public License, version 2 (GPL-2.0)
8
 *
9
 */
10
11
namespace phpbb\admanagement\migrations;
12
13
class install_user_schema extends \phpbb\db\migration\migration
14
{
15
	public function effectively_installed()
16
	{
17
		return $this->db_tools->sql_column_exists($this->table_prefix . 'users', 'user_acme');
18
	}
19
20
	static public function depends_on()
1 ignored issue
show
Coding Style introduced by
As per PSR2, the static declaration should come after the visibility declaration.
Loading history...
21
	{
22
		return array('\phpbb\db\migration\data\v31x\v314');
23
	}
24
25
	public function update_schema()
26
	{
27
		return array(
28
			'add_tables'		=> array(
29
				$this->table_prefix . 'acme_demo'	=> array(
30
					'COLUMNS'		=> array(
31
						'acme_id'			=> array('UINT', null, 'auto_increment'),
32
						'acme_name'			=> array('VCHAR:255', ''),
33
					),
34
					'PRIMARY_KEY'	=> 'acme_id',
35
				),
36
			),
37
			'add_columns'	=> array(
38
				$this->table_prefix . 'users'			=> array(
39
					'user_acme'				=> array('UINT', 0),
40
				),
41
			),
42
		);
43
	}
44
45
	public function revert_schema()
46
	{
47
		return array(
48
			'drop_columns'	=> array(
49
				$this->table_prefix . 'users'			=> array(
50
					'user_acme',
51
				),
52
			),
53
			'drop_tables'		=> array(
54
				$this->table_prefix . 'acme_demo',
55
			),
56
		);
57
	}
58
}
59