m1_initial_schema::update_schema()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 13
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 10
c 0
b 0
f 0
nc 1
nop 0
dl 0
loc 13
rs 9.9332
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
/**
14
* Migration stage 1: Initial schema
15
*/
16
class m1_initial_schema extends \phpbb\db\migration\migration
0 ignored issues
show
Bug introduced by
The type phpbb\db\migration\migration was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
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
	public static function depends_on()
30
	{
31
		return array('\phpbb\db\migration\data\v31x\v316');
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