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

m141230_075228_create_file   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

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

2 Methods

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