m150227_114524_init   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Importance

Changes 3
Bugs 0 Features 1
Metric Value
eloc 15
dl 0
loc 31
rs 10
c 3
b 0
f 1
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A down() 0 3 1
A up() 0 18 2
1
<?php
2
3
use yii\db\Migration;
4
5
/**
6
 * Class m150227_114524_init
7
 */
8
class m150227_114524_init extends Migration
9
{
10
    /**
11
     * This method contains the logic to be executed when applying this migration.
12
     */
13
    public function up()
14
    {
15
        $tableOptions = null;
16
17
        if ($this->db->driverName === 'mysql') {
18
            $tableOptions = 'CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE=InnoDB';
19
        }
20
21
        $this->createTable('{{%Setting}}', [
22
            'id' => $this->primaryKey(),
23
            'type' => $this->string(10)->notNull(),
24
            'section' => $this->string()->notNull(),
25
            'key' => $this->string()->notNull(),
26
            'value' => $this->text()->notNull(),
27
            'status' => $this->smallInteger()->notNull()->defaultValue(1),
28
            'createdAt' => $this->integer()->notNull(),
29
            'updatedAt' => $this->integer()->notNull(),
30
        ], $tableOptions);
31
    }
32
33
    /**
34
     * This method contains the logic to be executed when removing this migration.
35
     */
36
    public function down()
37
    {
38
        $this->dropTable('{{%Setting}}');
39
    }
40
}
41