Passed
Push — master ( 5df6aa...ddc494 )
by Aimeos
02:58
created

FosuserAddIndexes::getPostDependencies()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
/**
4
 * @license LGPLv3, http://opensource.org/licenses/LGPL-3.0
5
 * @copyright Aimeos (aimeos.org), 2016-2018
6
 */
7
8
9
namespace Aimeos\MW\Setup\Task;
10
11
12
/**
13
 * Migrate the database schema
14
 */
15
class FosuserAddIndexes extends \Aimeos\MW\Setup\Task\Base
16
{
17
	private $list = array(
18
		// done by Doctrine schema update
19
	);
20
21
22
	/**
23
	 * Returns the list of task names which depends on this task.
24
	 *
25
	 * @return array List of task names
26
	 */
27
	public function getPostDependencies()
28
	{
29
		return ['TablesCreateMShop'];
30
	}
31
32
33
	/**
34
	 * Update database schema
35
	 */
36
	public function migrate()
37
	{
38
		$this->msg( 'Adding indexes from "fos_user"', 0 ); $this->status( '' );
39
40
		$schema = $this->getSchema( 'db-customer' );
41
42
		foreach( $this->list as $idx => $stmt )
43
		{
44
			$this->msg( sprintf( 'Checking index "%1$s"', $idx ), 0 );
45
46
			if( $schema->tableExists( 'fos_user' ) === true
47
				&& $schema->indexExists( 'fos_user', $idx ) === false )
48
			{
49
				$this->execute( $stmt );
50
				$this->status( 'done' );
51
			}
52
			else
53
			{
54
				$this->status( 'OK' );
55
			}
56
		}
57
	}
58
}
59