m1_initial_schema   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 68
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 24
c 0
b 0
f 0
dl 0
loc 68
rs 10
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A depends_on() 0 3 1
A revert_schema() 0 6 1
A update_schema() 0 23 1
1
<?php
2
/**
3
*
4
* Auto Groups extension for the phpBB Forum Software package.
5
*
6
* @copyright (c) 2014 phpBB Limited <https://www.phpbb.com>
7
* @license GNU General Public License, version 2 (GPL-2.0)
8
*
9
*/
10
11
namespace phpbb\autogroups\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
	 * Assign migration file dependencies for this migration
20
	 *
21
	 * @return array Array of migration files
22
	 * @static
23
	 * @access public
24
	 */
25
	public static function depends_on()
26
	{
27
		return array('\phpbb\db\migration\data\v310\gold');
28
	}
29
30
	/**
31
	 * Add the auto groups table schema to the database:
32
	 *    auto groups:
33
	 *        autogroups_id
34
	 *        autogroups_type_id
35
	 *        autogroups_min_value
36
	 *        autogroups_max_value
37
	 *        autogroups_group_id
38
	 *        autogroups_default
39
	 *
40
	 * @return array Array of table schema
41
	 * @access public
42
	 */
43
	public function update_schema()
44
	{
45
		return array(
46
			'add_tables'	=> array(
47
				$this->table_prefix . 'autogroups_rules'	=> array(
48
					'COLUMNS'	=> array(
49
						'autogroups_id'			=> array('UINT', null, 'auto_increment'),
50
						'autogroups_type_id'	=> array('USINT', 0),
51
						'autogroups_min_value'	=> array('INT:11', 0),
52
						'autogroups_max_value'	=> array('INT:11', 0),
53
						'autogroups_group_id'	=> array('UINT', 0),
54
						'autogroups_default'	=> array('BOOL', 0),
55
					),
56
					'PRIMARY_KEY'	=> 'autogroups_id',
57
				),
58
				$this->table_prefix . 'autogroups_types'	=> array(
59
					'COLUMNS'	=> array(
60
						'autogroups_type_id'	=> array('USINT', null, 'auto_increment'),
61
						'autogroups_type_name'	=> array('VCHAR:255', ''),
62
					),
63
					'PRIMARY_KEY'	=> array('autogroups_type_id'),
64
					'KEYS'			=> array(
65
						'type'		=> array('UNIQUE', array('autogroups_type_name')),
66
					),
67
				),
68
			),
69
		);
70
	}
71
72
	/**
73
	 * Drop the auto groups table schema from the database
74
	 *
75
	 * @return array Array of table schema
76
	 * @access public
77
	 */
78
	public function revert_schema()
79
	{
80
		return array(
81
			'drop_tables'	=> array(
82
				$this->table_prefix . 'autogroups_rules',
83
				$this->table_prefix . 'autogroups_types',
84
			),
85
		);
86
	}
87
}
88