m170210_155249_update_screen_template_fk   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A up() 0 17 1
A down() 0 17 1
1
<?php
2
3
use yii\db\Migration;
4
5
/**
6
 * Handles the update of foreign key 'screen_template-template_background1' from table `screen_template`.
7
 */
8
// @codingStandardsIgnoreLine
9
class m170210_155249_update_screen_template_fk extends Migration
10
{
11
    public function up()
12
    {
13
        $this->dropForeignKey(
14
            'fk_screen_template_template_background1',
15
            'screen_template'
16
        );
17
18
        $this->addForeignKey(
19
            'fk_screen_template_template_background1',
20
            'screen_template',
21
            'background_id',
22
            'template_background',
23
            'id',
24
            'SET NULL',
25
            'SET NULL'
26
        );
27
    }
28
29
    public function down()
30
    {
31
        $this->dropForeignKey(
32
            'fk_screen_template_template_background1',
33
            'screen_template'
34
        );
35
36
        $this->addForeignKey(
37
            'fk_screen_template_template_background1',
38
            'screen_template',
39
            'background_id',
40
            'template_background',
41
            'id',
42
            'CASCADE',
43
            'CASCADE'
44
        );
45
    }
46
}
47