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
114
115
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\ImportExport\Setup;
use Magento\Framework\Setup\InstallSchemaInterface;
use Magento\Framework\Setup\ModuleContextInterface;
use Magento\Framework\Setup\SchemaSetupInterface;
/**
* @codeCoverageIgnore
*/
class InstallSchema implements InstallSchemaInterface
{
/**
* {@inheritdoc}
*/
public function install(SchemaSetupInterface $setup, ModuleContextInterface $context)
{
$installer = $setup;
$installer->startSetup();
/**
* Create table 'importexport_importdata'
*/
$table = $installer->getConnection()
->newTable($installer->getTable('importexport_importdata'))
->addColumn(
'id',
\Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
null,
['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true],
'Id'
)
->addColumn(
'entity',
\Magento\Framework\DB\Ddl\Table::TYPE_TEXT,
50,
['nullable' => false],
'Entity'
)
->addColumn(
'behavior',
\Magento\Framework\DB\Ddl\Table::TYPE_TEXT,
10,
['nullable' => false, 'default' => 'append'],
'Behavior'
)
->addColumn(
'data',
\Magento\Framework\DB\Ddl\Table::TYPE_TEXT,
'4G',
['default' => false],
'Data'
)
->setComment('Import Data Table');
$installer->getConnection()->createTable($table);
/**
* Create 'import_history' table.
*/
$table = $installer->getConnection()
->newTable($installer->getTable('import_history'))
->addColumn(
'history_id',
\Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
null,
['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true],
'History record Id'
)
->addColumn(
'started_at',
\Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP,
null,
['nullable' => false, 'default' => \Magento\Framework\DB\Ddl\Table::TIMESTAMP_INIT],
'Started at'
)
->addColumn(
'user_id',
\Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
null,
['unsigned' => true, 'nullable' => false, 'default' => '0'],
'User ID'
)
->addColumn(
'imported_file',
\Magento\Framework\DB\Ddl\Table::TYPE_TEXT,
255,
['nullable' => true],
'Imported file'
)
->addColumn(
'execution_time',
\Magento\Framework\DB\Ddl\Table::TYPE_TEXT,
255,
['nullable' => true],
'Execution time'
)
->addColumn(
'summary',
\Magento\Framework\DB\Ddl\Table::TYPE_TEXT,
255,
['nullable' => true],
'Summary'
)
->setComment('Import history table');
$installer->getConnection()->createTable($table);
$installer->endSetup();
}
}