Completed
Pull Request — master (#4)
by Jakub
07:41
created

m3_template_locations_schema::update_schema()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 14
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 14
rs 9.4285
cc 1
eloc 8
nc 1
nop 0
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\v10x;
12
13
class m3_template_locations_schema extends \phpbb\db\migration\migration
14
{
15
	/**
16
	* {@inheritDoc}
17
	*/
18
	public function effectively_installed()
19
	{
20
		return $this->db_tools->sql_table_exists($this->table_prefix . 'ad_locations');
21
	}
22
23
	/**
24
	* {@inheritDoc}
25
	*/
26
	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...
27
	{
28
		return array('\phpbb\admanagement\migrations\v10x\m2_acp_module');
29
	}
30
31
	/**
32
	* Add the ad_locations table schema to the database:
33
	*	ad_locations:
34
	*		ad_location_id
35
	*		ad_id
36
	*		location_id
37
	*
38
	* @return array Array of table schema
39
	* @access public
40
	*/
41
	public function update_schema()
42
	{
43
		return array(
44
			'add_tables'	=> array(
45
				$this->table_prefix . 'ad_locations'	=> array(
46
					'COLUMNS'	=> array(
47
						'ad_id'				=> array('UINT', 0),
48
						'location_id'		=> array('VCHAR:255', ''),
49
					),
50
					'PRIMARY_KEY'	=> array('ad_id', 'location_id'),
51
				),
52
			),
53
		);
54
	}
55
56
	/**
57
	* Drop the ad_locations table schema from the database
58
	*
59
	* @return array Array of table schema
60
	* @access public
61
	*/
62
	public function revert_schema()
63
	{
64
		return array(
65
			'drop_tables'	=> array(
66
				$this->table_prefix . 'ad_locations',
67
			),
68
		);
69
	}
70
}
71