InstallSchema   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
dl 0
loc 41
c 0
b 0
f 0
wmc 1
lcom 0
cbo 0
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A install() 0 31 1
1
<?php
2
3
namespace Richdynamix\PersonalisedProducts\Setup;
4
5
use Magento\Framework\Setup\InstallSchemaInterface;
6
use Magento\Framework\Setup\ModuleContextInterface;
7
use Magento\Framework\Setup\SchemaSetupInterface;
8
use Magento\Framework\DB\Ddl\Table;
9
10
/**
11
 * Class InstallSchema
12
 *
13
 * @category  Richdynamix
14
 * @package   PersonalisedProducts
15
 * @author    Steven Richardson ([email protected]) @mage_gizmo
16
 */
17
class InstallSchema implements InstallSchemaInterface
18
{
19
    /**
20
     * Installs DB schema for the module
21
     *
22
     * @param SchemaSetupInterface $setup
23
     * @param ModuleContextInterface $context
24
     * @return void
25
     */
26
    public function install(SchemaSetupInterface $setup, ModuleContextInterface $context)
27
    {
28
        $installer = $setup;
29
30
        $installer->startSetup();
31
32
        $table = $installer->getConnection()
33
            ->newTable($installer->getTable('rp_export_products'))
34
            ->addColumn(
35
                'increment_id',
36
                Table::TYPE_SMALLINT,
37
                null,
38
                ['identity' => true, 'nullable' => false, 'primary' => true],
39
                'Increment ID'
40
            )
41
            ->addColumn('product_id', Table::TYPE_INTEGER, 11, ['nullable' => false])
42
            ->addColumn(
43
                'is_exported',
44
                Table::TYPE_SMALLINT,
45
                null,
46
                ['nullable' => false, 'default' => '0'],
47
                'Has the product been exported?'
48
            )
49
            ->addColumn('creation_time', Table::TYPE_DATETIME, null, ['nullable' => false], 'Creation Time')
50
            ->addColumn('update_time', Table::TYPE_DATETIME, null, ['nullable' => false], 'Update Time')
51
            ->setComment('Personalised Products export to PredictionIO');
52
53
        $installer->getConnection()->createTable($table);
54
55
        $installer->endSetup();
56
    }
57
}
58