InstallSchema::install()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 35
Code Lines 26

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 26
nc 1
nop 2
dl 0
loc 35
rs 9.504
c 0
b 0
f 0
1
<?php
2
3
namespace Pagantis\Pagantis\Setup;
4
5
use Magento\Framework\Setup\InstallSchemaInterface;
6
use Magento\Framework\Setup\ModuleContextInterface;
7
use Magento\Framework\Setup\SchemaSetupInterface;
8
9
class InstallSchema implements InstallSchemaInterface
10
{
11
    /** Config tablename */
12
    const CONFIG_TABLE = 'Pagantis_config';
13
14
    /**
15
     * @param SchemaSetupInterface   $setup
16
     * @param ModuleContextInterface $context
17
     *
18
     * @throws \Zend_Db_Exception
19
     */
20
    public function install(SchemaSetupInterface $setup, ModuleContextInterface $context)
21
    {
22
        $installer = $setup;
23
24
        $installer->startSetup();
25
26
        $table = $installer->getConnection()
27
                           ->newTable($installer->getTable(self::CONFIG_TABLE))
28
                           ->addColumn(
29
                               'id',
30
                               \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
31
                               null,
32
                               ['identity' => true, 'unsigned' => true, 'nullable' =>
33
                                   false, 'primary' => true],
34
                               'Entity ID'
35
                           )
36
                           ->addColumn(
37
                               'config',
38
                               \Magento\Framework\DB\Ddl\Table::TYPE_TEXT,
39
                               60,
40
                               ['nullable' => false],
41
                               'Config'
42
                           )
43
                        ->addColumn(
44
                            'value',
45
                            \Magento\Framework\DB\Ddl\Table::TYPE_TEXT,
46
                            1000,
47
                            ['nullable' => false],
48
                            'Value'
49
                        )
50
                           ->setComment('Pagantis config table');
51
52
        $installer->getConnection()->createTable($table);
53
54
        $installer->endSetup();
55
    }
56
}
57