m141230_043535_create_settings   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A safeUp() 0 14 2
A safeDown() 0 4 1
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