m160516_095943_init   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A up() 0 14 3
A down() 0 4 1
1
<?php
2
3
use yii\db\Migration;
4
5
class m160516_095943_init extends Migration
6
{
7
    public function up()
8
    {
9
        $tableOptions = null;
10
11
        if ($this->db->driverName === 'mysql' || $this->db->driverName === 'mariadb') {
12
            $tableOptions = 'CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE=InnoDB';
13
        }
14
15
        $this->createTable('{{%Cart}}', [
16
            'sessionId' => $this->string(),
17
            'cartData' => $this->text(),
18
        ], $tableOptions);
19
        $this->addPrimaryKey('cart_pk', '{{%Cart}}', 'sessionId');
20
    }
21
22
    public function down()
23
    {
24
        $this->dropTable('{{%Cart}}');
25
    }
26
}
27