m141230_043535_create_settings::safeDown()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
use yii\db\Schema;
4
5
class m141230_043535_create_settings extends \yii\db\Migration
6
{
7
    public function safeUp()
8
    {
9
        $tableOptions = null;
10
        if ($this->db->driverName === 'mysql') {
11
            $tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB';
12
        }
13
14
        $this->createTable('{{%settings}}', [
15
            'key'   => Schema::TYPE_STRING . ' NOT NULL',
16
            'value' => Schema::TYPE_TEXT,
17
        ], $tableOptions);
18
19
        $this->addPrimaryKey('key', '{{%settings}}', 'key');
20
    }
21
22
    public function safeDown()
23
    {
24
        $this->dropTable('{{%settings}}');
25
    }
26
}
27