Completed
Push — master ( 7d4e77...353440 )
by Matt
08:22
created

m1_initial_schema::effectively_installed()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
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\admanagement\migrations\v10x;
12
13
/**
14
* Migration stage 1: Initial schema
15
*/
16
class m1_initial_schema extends \phpbb\db\migration\migration
17
{
18
	/**
19
	* {@inheritDoc}
20
	*/
21
	public function effectively_installed()
22
	{
23
		return $this->db_tools->sql_table_exists($this->table_prefix . 'ads');
24
	}
25
26
	/**
27
	* {@inheritDoc}
28
	*/
29
	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...
30
	{
31
		return array('\phpbb\db\migration\data\v310\gold');
32
	}
33
34
	/**
35
	* Add the ads table schema to the database:
36
	*	ads:
37
	*		ad_id
38
	*		ad_name
39
	*		ad_note
40
	*		ad_code
41
	*		ad_enabled
42
	*
43
	* @return array Array of table schema
44
	* @access public
45
	*/
46
	public function update_schema()
47
	{
48
		return array(
49
			'add_tables'	=> array(
50
				$this->table_prefix . 'ads'	=> array(
51
					'COLUMNS'	=> array(
52
						'ad_id'			=> array('UINT', null, 'auto_increment'),
53
						'ad_name'		=> array('VCHAR:255', ''),
54
						'ad_note'		=> array('MTEXT_UNI', ''),
55
						'ad_code'		=> array('TEXT_UNI', ''),
56
						'ad_enabled'	=> array('BOOL', 0),
57
					),
58
					'PRIMARY_KEY'	=> 'ad_id',
59
				),
60
			),
61
		);
62
	}
63
64
	/**
65
	* Drop the ads table schema from the database
66
	*
67
	* @return array Array of table schema
68
	* @access public
69
	*/
70
	public function revert_schema()
71
	{
72
		return array(
73
			'drop_tables'	=> array(
74
				$this->table_prefix . 'ads',
75
			),
76
		);
77
	}
78
}
79