Completed
Push — master ( f45cc5...2edd5b )
by Igor
05:32
created

m141230_075228_create_file::safeDown()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
use yii\db\Schema;
4
5
class m141230_075228_create_file 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('{{%file}}', [
15
            'id' => Schema::TYPE_PK,
16
            'user_id' => Schema::TYPE_INTEGER . " NOT NULL DEFAULT 0",
17
            'title' => Schema::TYPE_STRING . " NOT NULL DEFAULT ''",
18
            'name' => Schema::TYPE_STRING . " NOT NULL DEFAULT ''",
19
            'date_create' => Schema::TYPE_TIMESTAMP . " NULL DEFAULT NULL",
20
            'date_update' => Schema::TYPE_TIMESTAMP . " NULL DEFAULT NULL",
21
            'ip' => Schema::TYPE_BIGINT . "(20) NOT NULL DEFAULT 0",
22
        ], $tableOptions);
23
    }
24
25
    public function safeDown()
26
    {
27
        $this->dropTable('{{%file}}');
28
    }
29
}
30