m1_schema::effectively_installed()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 1
c 1
b 0
f 1
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php
2
/**
3
*
4
* Collapsible Categories extension for the phpBB Forum Software package.
5
*
6
* @copyright (c) 2015 phpBB Limited <https://www.phpbb.com>
7
* @license GNU General Public License, version 2 (GPL-2.0)
8
*
9
*/
10
11
namespace phpbb\collapsiblecategories\migrations;
12
13
/**
14
 * Migration stage 1: Schema changes
15
 */
16
class m1_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
	 * Check if this migration is effectively installed
20
	 *
21
	 * @return bool True if this migration is installed, False if this migration is not installed
22
	 */
23
	public function effectively_installed()
24
	{
25
		return $this->db_tools->sql_column_exists($this->table_prefix . 'users', 'collapsible_categories');
26
	}
27
28
	/**
29
	 * Assign migration file dependencies for this migration
30
	 *
31
	 * @return array Array of migration files
32
	 * @static
33
	 */
34
	public static function depends_on()
35
	{
36
		return array('\phpbb\db\migration\data\v31x\v313');
37
	}
38
39
	/**
40
	 * Add the collapsible_categories column to the users table
41
	 *
42
	 * @return array Array of table schema
43
	 */
44
	public function update_schema()
45
	{
46
		return array(
47
			'add_columns'	=> array(
48
				$this->table_prefix . 'users'	=> array(
49
					'collapsible_categories'	=> array('TEXT', null),
50
				),
51
			),
52
		);
53
	}
54
55
	/**
56
	 * Drop the collapsible_categories column from the users table
57
	 *
58
	 * @return array Array of table schema
59
	 */
60
	public function revert_schema()
61
	{
62
		return array(
63
			'drop_columns'	=> array(
64
				$this->table_prefix . 'users'	=> array(
65
					'collapsible_categories',
66
				),
67
			),
68
		);
69
	}
70
}
71