m140526_181732_create_option_table::down()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 3
c 1
b 0
f 0
rs 10
cc 1
eloc 1
nc 1
nop 0
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