Passed
Push — master ( 94d09c...7ff05c )
by Aimeos
05:44
created

PriceMigrateTaxRateName   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 11
c 1
b 0
f 0
dl 0
loc 28
rs 10
wmc 4

3 Methods

Rating   Name   Duplication   Size   Complexity  
A up() 0 14 2
A after() 0 3 1
A before() 0 3 1
1
<?php
2
3
/**
4
 * @license LGPLv3, https://opensource.org/licenses/LGPL-3.0
5
 * @copyright Aimeos (aimeos.org), 2021
6
 */
7
8
9
namespace Aimeos\Upscheme\Task;
10
11
12
class PriceMigrateTaxRateName extends Base
13
{
14
	public function before() : array
15
	{
16
		return ['Price'];
17
	}
18
19
20
	public function after() : array
21
	{
22
		return ['PriceMigrateTaxrate'];
23
	}
24
25
26
	public function up()
27
	{
28
		$db = $this->db( 'db-price' );
29
30
		if( !$db->hasTable( 'mshop_price' ) ) {
31
			return;
32
		}
33
34
		$this->info( 'Migrating taxrate name in price table', 'v' );
35
36
		$db->stmt()->update( 'mshop_price' )
37
			->set( 'taxrate', 'REPLACE(' . $db->qi( 'taxrate' ) . ', \'{"":\', \'{"tax":\')' )
38
			->where( $db->qi( 'taxrate' ) . ' LIKE \'{"":%\'' )
39
			->execute();
40
	}
41
}
42