Completed
Push — master ( fad164...382ed9 )
by Matt
17s
created

m8_priority::depends_on()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 4
Ratio 100 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 4
loc 4
rs 10
cc 1
eloc 2
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\ads\migrations\v10x;
12
13 View Code Duplication
class m8_priority extends \phpbb\db\migration\migration
1 ignored issue
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
14
{
15
	/**
16
	* {@inheritDoc}
17
	*/
18
	public function effectively_installed()
19
	{
20
		return $this->db_tools->sql_column_exists($this->table_prefix . 'ads', 'ad_priority');
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 priority to ads table
33
	*
34
	* @return array Array of table schema
35
	* @access public
36
	*/
37
	public function update_schema()
38
	{
39
		return array(
40
			'add_columns' => array(
41
				$this->table_prefix . 'ads' => array(
42
					'ad_priority' => array('TINT:2', 5),
43
				),
44
			),
45
		);
46
	}
47
48
	/**
49
	* Drop the priority from ads table
50
	*
51
	* @return array Array of table schema
52
	* @access public
53
	*/
54
	public function revert_schema()
55
	{
56
		return array(
57
			'drop_columns' => array(
58
				$this->table_prefix . 'ads' => array(
59
					'ad_priority',
60
				),
61
			),
62
		);
63
	}
64
}
65