1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\Customer\Setup;
use Magento\Framework\Setup\UpgradeSchemaInterface;
use Magento\Framework\Setup\ModuleContextInterface;
use Magento\Framework\Setup\SchemaSetupInterface;
/**
* @codeCoverageIgnore
*/
class UpgradeSchema implements UpgradeSchemaInterface
{
/**
* {@inheritdoc}
*/
public function upgrade(SchemaSetupInterface $setup, ModuleContextInterface $context)
{
$setup->startSetup();
if (version_compare($context->getVersion(), '2.0.0.1') < 0) {
$connection = $setup->getConnection();
$connection->addIndex(
$setup->getTable('customer_visitor'),
$setup->getIdxName('customer_visitor', ['last_visit_at']),
['last_visit_at']
);
}
if (version_compare($context->getVersion(), '2.0.1', '<')) {
$setup->getConnection()->addColumn(
$setup->getTable('customer_eav_attribute'),
'is_used_in_grid',
[
'type' => \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT,
'unsigned' => true,
'nullable' => false,
'default' => '0',
'comment' => 'Is Used in Grid'
]
);
$setup->getConnection()->addColumn(
$setup->getTable('customer_eav_attribute'),
'is_visible_in_grid',
[
'type' => \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT,
'unsigned' => true,
'nullable' => false,
'default' => '0',
'comment' => 'Is Visible in Grid'
]
);
$setup->getConnection()->addColumn(
$setup->getTable('customer_eav_attribute'),
'is_filterable_in_grid',
[
'type' => \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT,
'unsigned' => true,
'nullable' => false,
'default' => '0',
'comment' => 'Is Filterable in Grid'
]
);
$setup->getConnection()->addColumn(
$setup->getTable('customer_eav_attribute'),
'is_searchable_in_grid',
[
'type' => \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT,
'unsigned' => true,
'nullable' => false,
'default' => '0',
'comment' => 'Is Searchable in Grid'
]
);
}
if (version_compare($context->getVersion(), '2.0.7', '<')) {
$setup->getConnection()->addColumn(
$setup->getTable('customer_entity'),
'failures_num',
[
'type' => \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT,
'nullable' => true,
'default' => '0',
'comment' => 'Failure Number'
]
);
$setup->getConnection()->addColumn(
$setup->getTable('customer_entity'),
'first_failure',
[
'type' => \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP,
'comment' => 'First Failure'
]
);
$setup->getConnection()->addColumn(
$setup->getTable('customer_entity'),
'lock_expires',
[
'type' => \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP,
'comment' => 'Lock Expiration Date'
]
);
}
$setup->endSetup();
}
}