safeUp()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 16
Code Lines 12

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 12
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 16
rs 9.8666
1
<?php
2
3
use yii\db\Migration;
4
5
/**
6
 * Class m180501_161624_create_s3_file_foreign_keys
7
 */
8
class m180501_161624_create_s3_file_foreign_keys extends Migration
9
{
10
    /**
11
     * {@inheritdoc}
12
     */
13
    public function safeUp()
14
    {
15
        $this->createIndex(
16
            'idx-s3_file_options-mediafileId',
17
            's3_file_options',
18
            'mediafileId'
19
        );
20
21
        $this->addForeignKey(
22
            'fk-s3_file_options-mediafileId',
23
            's3_file_options',
24
            'mediafileId',
25
            'mediafiles',
26
            'id',
27
            'CASCADE',
28
            'CASCADE'
29
        );
30
    }
31
32
    /**
33
     * {@inheritdoc}
34
     */
35
    public function safeDown()
36
    {
37
        $this->dropForeignKey(
38
            'fk-s3_file_options-mediafileId',
39
            's3_file_options'
40
        );
41
42
        $this->dropIndex(
43
            'idx-s3_file_options-mediafileId',
44
            's3_file_options'
45
        );
46
    }
47
}
48