CustomerMigrateTableInnoDB   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 7
c 1
b 0
f 0
dl 0
loc 27
rs 10
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A up() 0 11 2
A before() 0 3 1
1
<?php
2
3
/**
4
 * @license LGPLv3, http://opensource.org/licenses/LGPL-3.0
5
 * @copyright Aimeos (aimeos.org), 2022-2025
6
 */
7
8
9
namespace Aimeos\Upscheme\Task;
10
11
12
/**
13
 * Changes the table type to InnoDB
14
 */
15
class CustomerMigrateTableInnoDB extends Base
16
{
17
	/**
18
	 * Returns the list of task names which depends on this task.
19
	 *
20
	 * @return array List of task names
21
	 */
22
	public function before() : array
23
	{
24
		return ['Customer'];
25
	}
26
27
28
	/**
29
	 * Executes the task
30
	 */
31
	public function up()
32
	{
33
		$db = $this->db( 'db-customer' );
34
35
		if( !$db->hasTable( 'users' ) ) {
36
			return;
37
		}
38
39
		$this->info( sprintf( 'Migrate users table engine to InnoDB' ), 'vv' );
40
41
		$db->for( 'mysql', 'ALTER TABLE users ENGINE=InnoDB' );
42
	}
43
}
44