m140618_045255_create_settings   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A up() 0 21 2
A down() 0 4 1
1
<?php
2
/**
3
 * @link http://phe.me
4
 * @copyright Copyright (c) 2014 Pheme
5
 * @license MIT http://opensource.org/licenses/MIT
6
 */
7
8
/**
9
 * @author Aris Karageorgos <[email protected]>
10
 */
11
class m140618_045255_create_settings extends \yii\db\Migration
12
{
13
    public function up()
14
    {
15
        $tableOptions = null;
16
        if ($this->db->driverName === 'mysql') {
17
            $tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB';
18
        }
19
        $this->createTable(
20
            '{{%settings}}',
21
            [
22
                'id' => $this->primaryKey(),
23
                'type' => $this->string(255)->notNull(),
24
                'section' => $this->string(255)->notNull(),
25
                'key' => $this->string(255)->notNull(),
26
                'value' => $this->text(),
27
                'active' => $this->boolean(),
28
                'created' => $this->dateTime(),
29
                'modified' => $this->dateTime(),
30
            ],
31
            $tableOptions
32
        );
33
    }
34
35
    public function down()
36
    {
37
        $this->dropTable('{{%settings}}');
38
    }
39
}
40