m141230_043249_create_user_profile_to_file   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A safeUp() 0 20 1
A safeDown() 0 4 1
1
<?php
2
3
use app\migrations\Migration;
4
5
class m141230_043249_create_user_profile_to_file extends Migration
6
{
7
    public function safeUp()
8
    {
9
        $this->createTable('{{%user_profile_to_file}}', [
10
            'id' => $this->primaryKey(),
11
            'user_id' => $this->integer()->notNull()->defaultValue(0),
12
            'file_id' => $this->integer()->notNull()->defaultValue(0),
13
        ], $this->tableOptions);
14
15
        $this->createIndex('link', '{{%user_profile_to_file}}', 'user_id, file_id');
16
17
        $this->addForeignKey(
18
            'fk_user_profile_to_file__user_id__user_id',
19
            '{{%user_profile_to_file}}',
20
            'user_id',
21
            '{{%user}}',
22
            'id',
23
            'CASCADE',
24
            'CASCADE'
25
        );
26
    }
27
28
    public function safeDown()
29
    {
30
        $this->dropTable('{{%user_profile_to_file}}');
31
    }
32
}
33