Completed
Push — master ( 6494b1...504660 )
by Igor
02:00
created

m160516_095943_init::up()   A

Complexity

Conditions 3
Paths 2

Size

Total Lines 14
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 14
rs 9.4285
cc 3
eloc 9
nc 2
nop 0
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
            'PRIMARY KEY (`sessionId`)',
19
        ], $tableOptions);
20
    }
21
22
    public function down()
23
    {
24
        $this->dropTable('{{%Cart}}');
25
    }
26
}
27