Completed
Push — master ( 050438...0a0307 )
by Matt
19s
created

m3_template_locations_schema   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 57
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 0
dl 0
loc 57
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A effectively_installed() 0 4 1
A depends_on() 0 4 1
A update_schema() 0 14 1
A revert_schema() 0 8 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\ads\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()
27
	{
28
		return array('\phpbb\ads\migrations\v10x\m1_initial_schema');
29
	}
30
31
	/**
32
	* Add the ad_locations table schema to the database:
33
	*	ad_locations:
34
	*		ad_id
35
	*		location_id
36
	*
37
	* @return array Array of table schema
38
	* @access public
39
	*/
40
	public function update_schema()
41
	{
42
		return array(
43
			'add_tables'	=> array(
44
				$this->table_prefix . 'ad_locations'	=> array(
45
					'COLUMNS'	=> array(
46
						'ad_id'				=> array('UINT', 0),
47
						'location_id'		=> array('VCHAR:255', ''),
48
					),
49
					'PRIMARY_KEY'	=> array('ad_id', 'location_id'),
50
				),
51
			),
52
		);
53
	}
54
55
	/**
56
	* Drop the ad_locations table schema from the database
57
	*
58
	* @return array Array of table schema
59
	* @access public
60
	*/
61
	public function revert_schema()
62
	{
63
		return array(
64
			'drop_tables'	=> array(
65
				$this->table_prefix . 'ad_locations',
66
			),
67
		);
68
	}
69
}
70