m140526_181732_create_option_table   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A down() 0 3 1
A up() 0 12 2
1
<?php
2
3
use yii\db\Schema;
4
5
class m140526_181732_create_option_table extends \yii\db\Migration
6
{
7
    public function up()
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('{{%option}}', [
15
            'id' => Schema::TYPE_PK,
16
            'name' => Schema::TYPE_TEXT . ' NOT NULL',
17
            'weight' => Schema::TYPE_INTEGER . ' NOT NULL',
18
        ], $tableOptions);
19
    }
20
21
    public function down()
22
    {
23
        $this->dropTable('{{%option}}');
24
    }
25
}
26