Completed
Push — master ( 625d55...2d12e1 )
by Carsten
12:37
created

m160313_153426_session_init::up()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 15
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 10
CRAP Score 2.003

Importance

Changes 0
Metric Value
dl 0
loc 15
ccs 10
cts 11
cp 0.9091
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 10
nc 2
nop 0
crap 2.003
1
<?php
2
/**
3
 * @link http://www.yiiframework.com/
4
 * @copyright Copyright (c) 2008 Yii Software LLC
5
 * @license http://www.yiiframework.com/license/
6
 */
7
8
use yii\db\Migration;
9
10
/**
11
 * Initializes Session tables
12
 *
13
 * @author Misbahul D Munir <[email protected]>
14
 * @since 2.0.8
15
 */
16
class m160313_153426_session_init extends Migration
17
{
18
19
    /**
20
     * @inheritdoc
21
     */
22 1
    public function up()
23
    {
24 1
        $tableOptions = null;
25 1
        if ($this->db->driverName === 'mysql') {
26
            // http://stackoverflow.com/questions/766809/whats-the-difference-between-utf8-general-ci-and-utf8-unicode-ci
27
            $tableOptions = 'CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE=InnoDB';
28
        }
29
30 1
        $this->createTable('{{%session}}', [
31 1
            'id' => $this->string()->notNull(),
32 1
            'expire' => $this->integer(),
33 1
            'data' => $this->binary(),
34 1
            'PRIMARY KEY ([[id]])',
35 1
        ], $tableOptions);
36 1
    }
37
38
    /**
39
     * @inheritdoc
40
     */
41 1
    public function down()
42
    {
43 1
        $this->dropTable('{{%session}}');
44 1
    }
45
}
46