1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* @license LGPLv3, http://opensource.org/licenses/LGPL-3.0 |
5
|
|
|
* @copyright Aimeos (aimeos.org), 2018 |
6
|
|
|
*/ |
7
|
|
|
|
8
|
|
|
|
9
|
|
|
namespace Aimeos\MW\Setup\Task; |
10
|
|
|
|
11
|
|
|
|
12
|
|
|
/** |
13
|
|
|
* Adds typeid column to list tables and migrates data in type column. |
14
|
|
|
*/ |
15
|
|
|
class IndexRemoveCtimeEditor extends \Aimeos\MW\Setup\Task\Base |
16
|
|
|
{ |
17
|
|
|
private $sql = [ |
18
|
|
|
'mshop_index_attribute' => [ |
19
|
|
|
'ALTER TABLE "mshop_index_attribute" DROP "ctime"', |
20
|
|
|
'ALTER TABLE "mshop_index_attribute" DROP "editor"', |
21
|
|
|
], |
22
|
|
|
'mshop_index_catalog' => [ |
23
|
|
|
'ALTER TABLE "mshop_index_catalog" DROP "ctime"', |
24
|
|
|
'ALTER TABLE "mshop_index_catalog" DROP "editor"', |
25
|
|
|
], |
26
|
|
|
'mshop_index_price' => [ |
27
|
|
|
'ALTER TABLE "mshop_index_price" DROP "ctime"', |
28
|
|
|
'ALTER TABLE "mshop_index_price" DROP "editor"', |
29
|
|
|
], |
30
|
|
|
'mshop_index_supplier' => [ |
31
|
|
|
'ALTER TABLE "mshop_index_supplier" DROP "ctime"', |
32
|
|
|
'ALTER TABLE "mshop_index_supplier" DROP "editor"', |
33
|
|
|
], |
34
|
|
|
'mshop_index_text' => [ |
35
|
|
|
'ALTER TABLE "mshop_index_text" DROP "ctime"', |
36
|
|
|
'ALTER TABLE "mshop_index_text" DROP "editor"', |
37
|
|
|
], |
38
|
|
|
]; |
39
|
|
|
|
40
|
|
|
|
41
|
|
|
/** |
42
|
|
|
* Returns the list of task names which this task depends on. |
43
|
|
|
* |
44
|
|
|
* @return string[] List of task names |
45
|
|
|
*/ |
46
|
|
|
public function getPreDependencies() |
47
|
|
|
{ |
48
|
|
|
return ['TablesCreateMShop']; |
49
|
|
|
} |
50
|
|
|
|
51
|
|
|
|
52
|
|
|
/** |
53
|
|
|
* Returns the list of task names which depends on this task. |
54
|
|
|
* |
55
|
|
|
* @return string[] List of task names |
56
|
|
|
*/ |
57
|
|
|
public function getPostDependencies() |
58
|
|
|
{ |
59
|
|
|
return ['MShopSetLocale']; |
60
|
|
|
} |
61
|
|
|
|
62
|
|
|
|
63
|
|
|
/** |
64
|
|
|
* Executes the task |
65
|
|
|
*/ |
66
|
|
|
public function migrate() |
67
|
|
|
{ |
68
|
|
|
$this->msg( 'Remove ctime/editor from index tables', 0 ); $this->status( '' ); |
69
|
|
|
$schema = $this->getSchema( 'db-product' ); |
70
|
|
|
|
71
|
|
|
foreach( $this->sql as $table => $stmtList ) |
72
|
|
|
{ |
73
|
|
|
$this->msg( sprintf( 'Checking table "%1$s": ', $table ), 1 ); |
74
|
|
|
|
75
|
|
|
if( $schema->tableExists( $table ) === true |
76
|
|
|
&& $schema->columnExists( $table, 'ctime' ) === true |
77
|
|
|
&& $schema->columnExists( $table, 'editor' ) === true ) |
78
|
|
|
{ |
79
|
|
|
$this->executeList( $stmtList ); |
80
|
|
|
$this->status( 'done' ); |
81
|
|
|
} |
82
|
|
|
else |
83
|
|
|
{ |
84
|
|
|
$this->status( 'OK' ); |
85
|
|
|
} |
86
|
|
|
} |
87
|
|
|
} |
88
|
|
|
} |